Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] with(c) #22

Open
xem opened this issue Mar 3, 2015 · 1 comment
Open

[enhancement] with(c) #22

xem opened this issue Mar 3, 2015 · 1 comment

Comments

@xem
Copy link

xem commented Mar 3, 2015

Sometimes, you can achieve a better compression by evaluating all the code with "with(c)".
It saves 2 bytes everytime you call a context function

Ex:

c.fill() => fill()

Could it be added in RegPack?

Cheers

@Siorki
Copy link
Owner

Siorki commented Mar 3, 2015

Using with(...) can cause a serious performance hit and halve - or worst - your framerate. For this reason I shall keep it an option as is currently done for with(Math).

The expected gain would be 2n-7, n being the number of copies of "c.". 8-10 occurrences (average in benchmark group) mean around 10 bytes shaved off.

Prior investigation is needed to understand the interactions in having both with(c) and method hashing for c. I suspect possible shadowing between variables and method names that have been reduced to one or two letters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants