Efficient object updates for closed records #3244
Efficient object updates for closed records #3244fehrenbach wants to merge 5 commits intopurescript:masterfrom
Conversation
fixes purescript#3157 adds a CoreFn optimization pass
|
We're making a trade-off here, right? This will increase the size of the generated JS depending on how large of a record we are copying. Should we pick a number of record properties at which we switch back to the loop? |
|
I think we can set that threshold pretty high if we're going to have it, like 100 or something. |
|
It certainly is a trade-off. The appropriate measure to optimize for generated code size would be something like sum of length of field names that are not updated compared to size of the update loop. In my dreams, we would just generate I can add a threshold, in whatever form, but to be honest I'd rather wait for someone to actually have a problem with huge records. |
|
For the record: |
I'd tend to agree with that 👍 |
|
Also, sorry we're only getting around to commenting on this now - but big thanks! This is something I've wanted to do for a long time. |
…ct update to record literal purescript/purescript#3244 Not possible to reverse this without type info. Fix #19
See #1493.
This uses @matthewleon 's newly introduced CoreFn optimization infrastructure (#3218).