indus / Zodiac

rewrite of jnicol/particleground
MIT License
101 stars 7 forks source link

Any performance improvements that could be done? #4

Closed agauniyal closed 8 years ago

agauniyal commented 8 years ago

particles.js takes much less cpu (around 40-50%) than zodiac which is taking almost double(70-80%) cpu processing. could we expect any performance improvements in future?

Thank you :smile:

agauniyal commented 8 years ago
Name Time %
(Program) 470.0ms 63.52%
arc 84.9ms 11.47%
update 160.7ms 22.57%
moveTo/ stroke/ clearRect ~15ms ~2%
agauniyal commented 8 years ago

also performance on mozilla is worse than on chrome. running zodiac on an old machine with up to date firefox makes even scrolling a painful experience.

agauniyal commented 8 years ago

These might help for reference -

indus commented 8 years ago

Why don't you just use particle.js when it is more performant? Even I now consider using it for JS.ORG if it is that much better.

agauniyal commented 8 years ago

I don't want to include another library(jquery) for including one library. This seems much better in terms of simplicity and ease of use. Sadly I'm not familiar with canvas and stuff, otherwise I would have sent an PR instead of opening an issue.

Don't get me wrong, I'm already using this library and its working as intended. I'm just asking if you plan to make any improvements so that other users could be benefited :smile:.

indus commented 8 years ago

I really don't know why performance is worse then in another library and I think I have the time right now to investigate on it (maybe some hard to debug deoptimication of code)

A not wanted jQuery dependecy was the main reason for me to write zodiac. But it really should be trivial to strip jQuery from particle.js . There is only little use for it in a canvas library: measure the canvas, bind events to it, initialize the code. If you know how to do these things without jQuery it should be a simple task to rewrite.

agauniyal commented 8 years ago

Thankyou :smile: I'll look into it.