Тёмный

Fast F#: Read-Only Struct Wrappers 

Fast F#
Подписаться 2,2 тыс.
Просмотров 822
50% 1

There are many situations where we want to take advantage of the performance of a mutable collection to build a result, but then we want to provide a read-only wrapper of the data. The facilities built into .NET are slower than using the raw, mutable collection, so let's look at how we can implement our own read-only wrappers that match the performance of the underlying collection.
Writing a Dictionary Video: • Fast F#: Writing a Dic...
=== Contact ===
Email: hi@fastfsharp.com
Mastadon: mastodon.sdf.org/@fastfsharp
Twitter: / fastfsharp
=== Tags ===
Tags: #fsharp, #dotnet

Наука

Опубликовано:

 

9 апр 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@tw1s73d
@tw1s73d Год назад
Thanks for the video! Keep it up!
@alexk6745
@alexk6745 8 месяцев назад
Great! I wonder if that static struct will be consuming sort of twice memory for taht type from the stack? Am I right? I have a feeling that that static type already uses on a heap pointer to the dictionary and we're adding one more. Am I right or not?
@ilyamurashov
@ilyamurashov Год назад
You could hide _values with EditorBrowsableAttribute
@FastFSharp
@FastFSharp Год назад
Oh nice! I didn't know that!
@robertlenders8755
@robertlenders8755 Год назад
Thanks for the great video as always. I'm curious if you've done any work with the MemoryMarshal class and the ability to "project" a Span as arbitrary struct data types?
@FastFSharp
@FastFSharp Год назад
I have. It's super dangerous and rarely necessary. I'll be going deeper and deeper into the darkness with this series so we'll get there 😊
@robertlenders8755
@robertlenders8755 Год назад
@@FastFSharp I am already down the rabbit hole working with a complex C ABI with unions and variable-length structures. Looking into this technique as a way to work with stack-allocated bytes or byte arrays for interop with minimal copying.
@WerewolfAll
@WerewolfAll Год назад
Why not to use :> IReadOnlyDictionary interface implemented by Dictionary?
@FastFSharp
@FastFSharp Год назад
Performance. There is significant performance degradation when you hide concrete types behind interfaces.
@jeremybobbin
@jeremybobbin Год назад
Interesting that readOnlyDict is suboptimal, and that inlined-functions are subject to member accessibility. Especially from an almost 20-year-old language. What’s going on here?
@FastFSharp
@FastFSharp Год назад
The F# compiler is actually inlining that code but the CLR then tries to compile the IL and it's trying to access a private member, therefore it fails.
@bentrasmussen7631
@bentrasmussen7631 Год назад
What about [] on the indexed property getter - do you think that would have worse performance than using F# compile-time inlining? I guess the F# inline keyword would guarantee inlining whereas the attribute would make inlining likely but not guarantee it - but guarantee no mutation because the internal state would not need to be made public.
Далее
Fast F#: Intro to Options
23:30
Просмотров 663
Fast F#: Mapping Domain to Indexes
23:59
Просмотров 994
Fast F#: Anonymous Records
17:02
Просмотров 567
Fixing RAG with GraphRAG
15:04
Просмотров 3,5 тыс.
Fast F#: Intro to Active Patterns
25:21
Просмотров 1,4 тыс.
Use Arc Instead of Vec
15:21
Просмотров 137 тыс.
Dependency Injection, The Best Pattern
13:16
Просмотров 757 тыс.
Fast F#: Intro to Interfaces
22:01
Просмотров 763
Microservices with Databases can be challenging...
20:52
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
Просмотров 154 тыс.
Развод с OZON - ноутбук за 2875₽
17:48
Улучшил свои Apple Watch!
0:25
Просмотров 37 тыс.