Area for optimization #1

Open
opened 2018-01-23 23:24:22 +07:00 by brian · 0 comments
Owner

Loop For-of, For inverse

Bench: https://jsperf.com/cache-length-no-cache https://jsperf.com/for-loop-research https://www.incredible-web.com/blog/performance-of-for-loops-with-javascript/
Done
Justify by showing in isolated case is enough.

Reduce property lookup of an object

Reduce GC

https://stackoverflow.com/questions/18364175/best-practices-for-reducing-garbage-collector-activity-in-javascript#18411275
Don't declare stuff often. delete doesn't help.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
Becnhmarks on clear array: http://jsben.ch/hyj65
__ Can't do much from now__

Multi-core

While JS support multi-thread, but not multi-core processing. HTML5 Web Workers allow multiple isolated processes to be run concurrently, each process have to communicate with each other via JSON strings.
Serializing and parsing objects to JSON is slow, and means multiple copies of the same data exist, probably way too much memory usage and overhead.

However: Web Workers could be used to do computation without blocking main thread.
Can be in future work

asm.js, amost no GC, may be faster for Ahead-of-time compilation

WebAssembly, should have speed up

### Loop For-of, For inverse Bench: https://jsperf.com/cache-length-no-cache https://jsperf.com/for-loop-research https://www.incredible-web.com/blog/performance-of-for-loops-with-javascript/ __Done__ Justify by showing in isolated case is enough. ### Reduce property lookup of an object ### Reduce GC https://stackoverflow.com/questions/18364175/best-practices-for-reducing-garbage-collector-activity-in-javascript#18411275 Don't declare stuff often. `delete` doesn't help. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete Becnhmarks on clear array: http://jsben.ch/hyj65 __ Can't do much from now__ ### Multi-core While JS support multi-thread, but not multi-core processing. HTML5 Web Workers allow multiple isolated processes to be run concurrently, each process have to communicate with each other via JSON strings. Serializing and parsing objects to JSON is slow, and means multiple copies of the same data exist, probably way too much memory usage and overhead. However: Web Workers could be used to do computation without blocking main thread. **Can be in future work** ### asm.js, amost no GC, may be faster for Ahead-of-time compilation ### WebAssembly, should have speed up
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: brian/d3-spring-model#1