Open parkerziegler opened 5 years ago
Hey Parker 👋
Sorry for the late reply. I haven’t made this native-compatible yet because I was optimising some operations for JS/v8. Since I do have the Rebel code files that have some shared Array operations porting this shouldn’t be too hard.
The problem I see with porting this is that resizable arrays have different performance characteristics than fixed size arrays. So it may turn out that native needs to be implemented differently. Hence I held off from implementing this already.
Resizing arrays isn’t possible with OCaml’s arrays, since they’re fixed blocks of memory. So either we have to change them to allow for preinitialised memory (which will worden memory usage on native) or come up with something else
👋 Hey @kitten, happy Saturday! Got some time to read through
pessimism
and it's really fun to learn about! My one question is, I notice we have quite a lot of use ofunsafe_get
methods onstring
s andarray
s, mostly, I'm assuming, to not have to deal withoption
types. Was this more to get this working quickly or because it's not really an eventuality we need to deal with? Admittedly, I'm still pretty foggy on how HAMTs work (the Wikipedia is a bit over my head 😅), so was curious to get some clarification here.I'm also speculating on whether or not we could use Reason's native
array
for some of the operations in an effort to removeJs.Array
entirely – the benefit I see there is that it can then be used in native Reason / OCaml for that glorious day when someone writes a native GraphQL client for Reason 😂. In any case, just curious and interested to hear your thoughts. If you'd be open to removing theunsafe_
methods I'd love to make a PR for it and get my feet wet!