-
Notifications
You must be signed in to change notification settings - Fork 18
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
More interpreter optimizations #107
Conversation
…io/node-protodef"" This reverts commit 019bb99.
I really suck at splitting changes into small commits * In `compiler.js` I move datatype kind constants into `utils.js` * Modified `protodef.js`, now interpreter faster up to 2x * Moved native-compiled datatypes to `shared/` directory
Also, `interpreter.js` now has `DATATYPE_NOCOPY` This constant could double the interpreter performance. Gonna seek for bottlenecks
I hope it doesn't hurt performance so mush.
Can you open a PR for node-minecraft-protocol using the interpreter and this PR as protodef version ? |
Could you explain what you did here and why it is faster ? |
This reverts commit 2a34b91.
@Saiv46 do you intend to finish this? |
I need to figure out what's missing here. Something stopped me from finishing this PR... Oh, yes, fields need to be optimized... |
`lodash-clonedeep` is much faster than `JSON.serialize`
@rom1504 First I was just refactoring existing code - first by just splitting it, then applying some optimizations from Recently I read this article about optimization fundamentals - so now I know what to do. By the way: - 396 passing (1s)
+ 396 passing (464ms)
- C:\Users\Admin\node-protodef>npx mocha ./benchmark/benchmark_all_types.js
+ D:\WORKING\Saiv46\node-protodef>npx mocha ./benchmark/benchmark_all_types.js
- read x 8,250 ops/sec ±2.34% (84 runs sampled)
- √ reads (6102ms)
+ read x 24,708 ops/sec ±7.08% (85 runs sampled)
+ √ reads (5752ms)
- write x 4,229 ops/sec ±12.03% (76 runs sampled)
- √ writes (5533ms)
+ write x 12,567 ops/sec ±25.72% (81 runs sampled)
+ √ writes (5635ms)
4 passing (23s) |
Now I should undo changes to compiler (because this is out of the scope of this PR) |
I was tried to make something more on this PR, but I run out of ideas that will not break anything. |
Closes #69 and #75
Benchmark results by @Karang (benchmark_all_types):