Expression icon indicating copy to clipboard operation
Expression copied to clipboard

[Doc] Structural sharing

Open ShalokShalom opened this issue 8 months ago • 4 comments

The documentation lacks currently any notion about structural sharing

Does any of the data types support that?

Or do they simply copy real data around behind the scenes?

ShalokShalom avatar May 07 '25 06:05 ShalokShalom

Hey, the data structures are agnostic to the data you add. Thus, even if the structure may be immutable, the Py-objects may or may not be immutable. What is the need and behavior you are looking for?

dbrattli avatar May 07 '25 07:05 dbrattli

I am asking if the implementation uses structural sharing.

That means, if they are really copied, or using something like an 'Hash Array Mapped Trie'

ShalokShalom avatar May 07 '25 08:05 ShalokShalom

The Map implementation in particular is a more or less direct port of F# Map to Python: https://github.com/fsharp/fsharp/blob/master/src/fsharp/FSharp.Core/map.fs

dbrattli avatar May 07 '25 08:05 dbrattli

And the others?

ShalokShalom avatar May 07 '25 08:05 ShalokShalom