Conversation
|
The calls to Anyway, this looks good, thanks. |
|
Indeed, using Array for a list may be an issue without a much smarter optimizer. Much of the existing PS code assumes the cost of unconsing is small, which is not in fact true when the list is backed by an Array. |
|
Well we have other options. @taku0 has a repository for 2-3-finger tree based sequences, for example. The problem is that the current cons pattern is baked into the code generator. If we had some sort of active pattern capability, things like that might be easier to use. Even singly-linked lists implemented as objects might perform better for some use cases. Probably worth looking at. I'm not sure how we could optimize away the calls to |
|
Would we rename the JS |
|
As for optimising the |
|
No, I think for interop reasons, Array has to refer to Javascript arrays, but it would be nice to have the option of using a persistent data structure with efficient cons and uncons with nice pattern matching syntax. |
This isn't ideal, but it's good for a 500ms faster typecheck in ps-in-ps on my machine. The main problem is the PS implementation results in two
array.slice(1)calls per each index being checked.