This PR introduces a round of optimizations of the generated C code. Original motivation was to attempt and match the speed at which the transformer package test suite runs. Unfortunately the generated still cannot and likely never will be able to match the optimizations V8 can perform at runtime.
I am opening this as a PR for visibility and in order to solicit feedback and/or ideas.
What has been done so far:
Port MagicDo optimization pass
Use purs_str_t as record keys
Lazily calculate and cache purs_str_t hash and utf8 size
Calculate string hashes (and lengths) lazily, and keep them in static storage. This avoids repeatedly heap-allocating the same string and repeatedly hashing it. This optimization is particularly important since typeclass dispatch is (unfortunately) represented as dictionary lookups in the corefn. See also #53
Unrelated, can be cherry-picked onto master/next: Support concurrent builds by compiling support files into local objects instead of relying on a shared libpurec.a object which has a number of issues (cannot be shared between builds with different CFLAGS or with/without GC, no debug information, etc.)
TODO
[ ] ~Support whileE and untilE optimizations in releaseResources pass~ will address separately when I have more spare time
[x] Update all packages in package-set again (chore)
This PR introduces a round of optimizations of the generated C code. Original motivation was to attempt and match the speed at which the transformer package test suite runs. Unfortunately the generated still cannot and likely never will be able to match the optimizations V8 can perform at runtime.
I am opening this as a PR for visibility and in order to solicit feedback and/or ideas.
What has been done so far:
purs_str_t
as record keyspurs_str_t
hash and utf8 sizeTODO
whileE
anduntilE
optimizations inreleaseResources
pass~ will address separately when I have more spare time