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

Move most functions out of closure #101

Merged

Conversation

thephoenixofthevoid
Copy link
Contributor

@thephoenixofthevoid thephoenixofthevoid commented Mar 23, 2021

Recreated pull request
I didn't figure out the problem, just nuked everything and built again

These changes improved performance. According to bench:

$ git checkout master
$ node benchmarks/encodedecode.js 
time 432
decode/s 231481.4814814815

$ git checkout upstream/master 
$ node benchmarks/encodedecode.js 
time 486
decode/s 205761.316872428

That is 10% improvement.

@mcollina
Copy link
Owner

awesome work! Is this good to land?

@thephoenixofthevoid
Copy link
Contributor Author

Second test:

$ git checkout upstream/master
$ node benchmarks/parseshortmap.js
time 1914
decode/s 522466.039707419

$ git checkout decoder-refactoring-2021
$ node benchmarks/parseshortmap.js
time 1813
decode/s 551571.9801434088

I am thinking about more changes, but we may land this one, because it's self-contained.
For example, we may use options as a context (by assigning decodingTypes and decode on it), and pass options object to each function.

@thephoenixofthevoid
Copy link
Contributor Author

thephoenixofthevoid commented Mar 23, 2021

It looks like tests do not cover very well decoding arrays. It missed the bug with object inside of array (that this commit introduced due to trivial mistake). Now will be fix.

@mcollina
Copy link
Owner

It looks like tests do not cover very well decoding arrays. It missed the bug with object inside of array (that this commit introduced due to trivial mistake). Now will be fix.

Can you add a test for this regression?

@mcollina
Copy link
Owner

Is it good to go?

@thephoenixofthevoid
Copy link
Contributor Author

It's ready to merge, I double-checked everything today, nothing should go wrong (the regression was trivial and quite surprising to see all tests green).

PS: looks like we need to invest some time into tests to make it more reliable --- maybe, structurize them a bit?

@mcollina
Copy link
Owner

I don't have much time to spend on this lib, but it you want to invest some time to improve it I'll be happy to add you to the repo.

@thephoenixofthevoid thephoenixofthevoid marked this pull request as ready for review March 24, 2021 22:36
@mcollina mcollina merged commit 76bd44f into mcollina:master Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants