Тёмный

Fast F#: Mapping Domain to Indexes 

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

When writing fast code, we want to work with Integers and Arrays as much as possible. To do this, we need a way of mapping our Domain representation down to raw Integers, though. Here I show you the technique I use daily to perform this mapping while maintaining a robust domain representation so that the compiler can help us as much as possible.
Code: github.com/mat...
=== Contact ===
Email: hi@fastfsharp.com
Mastadon: mastodon.sdf.o...
Twitter: / fastfsharp
=== Tags ===
Tags: #fsharp, #dotnet, #highperformance

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

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@ilyamurashov
@ilyamurashov Год назад
Great video as always! I'm really interested in this topic. Would love to hear you discuss it more, for example: how to manage live cycles and retain cache locality, tradeoffs between reusing an index vs. other techniques.
@JonnyD000
@JonnyD000 Год назад
If you're still curious about if there is an existing name for this kind of pattern, in Data Science/Machine Learning it's called One Hot Encoding.
@tropictiger2387
@tropictiger2387 Год назад
At 19:31 what happens in your ChickenIndex module's last line (n * 1)? What is this called?
@TatianaRacheva
@TatianaRacheva 7 месяцев назад
6:06 "Instead of using the raw chicken..." 😆
@havokgames8297
@havokgames8297 11 месяцев назад
How can the integers be used for something useful in the engine code - they don't have any data - do you end up packing some data into high bits of the integers or something similar?
@GlibVideo
@GlibVideo Год назад
Aren't we going to have same performance issues when we need to back and forward from chicken to index and then back? Is it easier if our chicken would have Id for example?
@FastFSharp
@FastFSharp Год назад
Excellent question. Once we map to the index we only work with the index inside of the engine code. I could have explained that better.
@GlibVideo
@GlibVideo Год назад
@@FastFSharp So you are loading all the "chickens" into the engine first, and then work with indexes, and do not really need to work with chicken anymore?
@FastFSharp
@FastFSharp Год назад
@@GlibVideo exactly! At the end, I’ll map results back to domain types but I only work with indexes in hot loops.
@KamillaMirabelle
@KamillaMirabelle Год назад
Have you ever tried to use marshalling/native memory management? It might help even more with the performance. You need to define struktural layout for each record/struct type, then you can read, write and use indirect typed pointers to them. If you know the number og can compute the number of elements you will use in a computation you can bulk allocate continues memory for them up front and place them there and free the memory once afterwards. This way you can handle when and how the memory are allocated and deallocated..
@amiralimov3074
@amiralimov3074 Год назад
Great video as always, loved your topological sort and dictionary series. Looking forward to some more long run content!
Далее
Fast F#: Read-Only Struct Wrappers
20:37
Просмотров 863
Fast F#: Abstraction Addiction
29:00
Просмотров 1,4 тыс.
OYUNCAK DİREKSİYON İLE ARABAYI SÜRDÜ 😱
00:16
Просмотров 4,4 млн
ВЫЗВАЛ ЗЛОГО СОНИКА #Shorts
00:38
Просмотров 65 тыс.
Fast F#: Intro to Active Patterns
25:21
Просмотров 1,5 тыс.
Fast F#: Anonymous Records
17:02
Просмотров 607
10 Crazy Python Operators That I Rarely Use
11:37
Просмотров 19 тыс.
F# for Performance-Critical Code, by Matthew Crews
1:03:23
Fast F#: Who Has Inspired You?
22:55
Просмотров 825