VincentGarreau / particles.js

A lightweight JavaScript library for creating particles
https://vincentgarreau.com/particles.js/
MIT License
28.89k stars 4.82k forks source link

Lags on Firefox #19

Open errogaht opened 9 years ago

errogaht commented 9 years ago

Hello! in chrome it works well, but ofcourse it lags in FireFox, very slow, and lags.

VincentGarreau commented 9 years ago

Hi!

Yes, unfortunately... I actually noticed for Firefox. I'll try to improve performance for the future releases ;)

luglio7 commented 9 years ago

Too bad, it crashed my session on Firefox.

watadarkstar commented 9 years ago

Hi @VincentGarreau I'm willing to fix this issue if you can mentor me through this bug. Any idea why its lagging on Firefox or what sections of the code I should look into that might be causing these performance issues?

ghost commented 9 years ago

@VincentGarreau you could start here ;)

lorenmh commented 9 years ago

@VincentGarreau if 'distanceParticles' is commented out, then the lag goes away

kitsunde commented 9 years ago

This might not be solvable because Firefox has some serious issues with lineTo. It's 21x slower than chrome: http://jsperf.com/draw-lines

I tried making a minimal proof of concept drawing 300 lines (no animation, no alpha transparency) and the performance degrades quickly with canvas size, it's completely unusable on rMBP. Mozilla also seem to be aware lineTo is slow: https://bugzilla.mozilla.org/show_bug.cgi?id=1001954

My small demo page drawing 300 lines: http://jsfiddle.net/4ry8pdpb/1/, in my actual project it's closer to 600 lines that's rendered effortlessly by chrome.

VincentGarreau commented 9 years ago

Thanks for your detailed explanation @Celc! I noticed that Firefox has serious issues with lineTo, and your explanation enlightened me. I hope it will be fixed soon...