wryun / es-shell

es: a shell with higher-order functions
http://wryun.github.io/es-shell/
Other
307 stars 25 forks source link

Perform deduplication on trees produced in initial.c #54

Closed jpco closed 10 months ago

jpco commented 1 year ago

This is a binary-size optimization, which (at this commit) reduces es' total binary size by about 10%. The improvement scales with the size of initial.es.

This is a very simple way to go about this - I suspect there's a clever way to do it more manually so that it's either faster or more effective, but I'm not smart enough to do that.

The memory sharing here strongly depends on the fact that the data structures in initial.c are static. If any of the data here could move, this would be completely unsound.

wryun commented 10 months ago

@mwgamera , as someone who actually knows about the code (cf me), does this seem sane?

mwgamera commented 10 months ago

Yes, lgtm.