Web workers - firefox vs. chromium (Chrome and MS Edge) - performance

I'am developping a fractal explorer in browser still in beta.
The general idea is to offer a navigation as fluid as possible.
I use of course a pool of web workers and split each image in n chunks where n is the number of available cpu (navigator.hardwareConcurrency).
Each worker calculates and posts back an ImageData.
It works great on chromium based navigators (ie Chrome and MS edge, both show roughly same performance). Safari is ok too.
On Firefox it's awful !
The mean time calculation is surprisingly roughly x8 on Firefox, the number of CPU and workers on my computer. So I suspected Firefox to run workers concurrently and not in parallell, but this assumption should be wrong as far as the mean time calculation is decreasing proportionnaly with the number of active workers as the chart shows.
So.... Is there anybody with an idea / explanation ?
thanks :)
A weird hack-solution
Trying to simplify my code for publishing it as kindly requested (thanks again #Kaiido), I have found a solution... well, not really a solution, let's say it's more a hack !
Adding anywhere in the worker's message handler a blank try {} catch {} block the performance of Firefox is equivalent (and sometimes better :) than Chrome.
code is here
Explanation ?

That was a bug in Firefox with their optimizer.
I did open an issue to their bug tracker and it's now fixed in latest Nightly (79.0a1 (2020-06-04)).

Related

How to figure out what's causing long DOM processing time?

I have a landing page to which I'm driving traffic through PPC. For a variety of reasons, I've come to believe that, even though the site is highly performant for me, it isn't for my actual visitors. So, I turned on AWS CloudWatch.
For me, with cleared caches, the page loads at around 0.9 seconds in Safari, 1.75 seconds in Firefox, and 2.25 seconds in Chrome. If I were in micro-optimization mode, I'd worry about that Chrome number, but right now, my issue is much bigger. According to CloudWatch, my real users are experiencing an average load time of 12.1 seconds! And of that 12.1 seconds, DOM processing is taking about 11 seconds:
Now, I'm not sure if I have to worry about the full 11 seconds, or just the part I've marked "A" — the processing that happens before it starts loading the DOM — but either way, how do I figure out what's causing this?
I know there's a way to simulate low network speed in devtools, but maybe there's also a way to throttle CPU? Or maybe there's a way to "look" at the waterfall in devtools and figure out which pieces are blocking the DOM Content loaded action? Then, even though they're fast for me, I can try to optimising those pieces. Or maybe a deeper level of diagnostics I can enable on CloudWatch? Or, maybe there's some other option I haven't considered.
FWIW, almost all of my visitors are on Android devices, and they're about 70% Chrome, 10% Android Browser.

Polymer Loading Slow in FireFox

This is a very vague question, but I have noticed that Polymer (both version 1.0 and 2.0) are very slow to load in Mozilla FireFox when you have a large number of custom elements.
Does anyone know any high-level, general strategies for increasing the load time?
The page loads near instantly in Chrome, but can take up to 4 seconds in FireFox. I can see on the network tab that the resources are coming just as fast, but the in-browser render time is significantly slower.
Or even a method to test exactly what is taking a while to load in FireFox - that would be very helpful. Right now, I can see each network request, but not just browser processing.
Thanks in advance!
**edit: the elements are all minified and vulcanized into 1 file.
Try loading the webcomponents-lite.min.js instead of webcomponents.js this should give you way better Performance in FF
Try using the PRPL-pattern.
It's described here: https://developers.google.com/web/fundamentals/performance/prpl-pattern/
Or use the optimizations polymer build gives you:
https://www.polymer-project.org/2.0/docs/tools/polymer-cli

How to improve Firefox performance?

I usually use Firefox as my main web browser, but one of the major problems it has is its memory consumption. After an hour using it, and with no more than 20 tabs opened, it can consume more than 1 GB, and this memory isn't released even if I close the majority or the tabs I have opened. The only solution in this situation is restarting it.
I have read some articles about tuning Firefox, such as:
http://forums.mozillazine.org/viewtopic.php?t=53650
http://sswam.com/2011/05/19/tuning-firefox-for-speed-enable-http-pipelining-etc/
http://www.technical-assistance.co.uk/kb/ffconfig.php
But the solutions given in these articles didn't work for me.
Has anyone managed to tun it to not consume an excesive amount of memory?
Thank you in advance
I had the same issues. After some digging, I've found this out:
https://support.mozilla.org/en-US/kb/firefox-slow-how-make-it-faster
It was very usefull to me. Hope it could help you too.
EDIT: The original link I've posted is offline. I dig again and decided to refer to this Mozilla's tutorial because it covers most of the hints I used to improve FF.
How many extensions/addons are you running? A large part of your problem could be that. Also, if that does indeed turn out to be your issue, a lot of the memory those addons take is tab-independent. So you're right to assume that the only way to stop that is to restart it fully. I use Chrome, so I'm not super familiar with whether or not you can disable extensions/addons individually without shutting your browser down, but I'd look into the possibility of that.

IE takes too much time to load the page compared to Firefox

I have a page which displays around 1000 records.
The page gets loaded quite easily on firefox..around 2 seconds. But same on IE taking more that 10 seconds.
I checked performance tuning on server side, and modified the hibernate Criteria query returning this whole data. But issue is still there.
I also tried to remove almost all the plugins from IE thinking those could be the culprits. But no impact. :(
Trying to monitor the UI components on IE developer tool, but didnt find much details.
Any suggestions please. :)
Thanks in Advance :)
Performance issues like this will be down to rendering the UI. The server side processing won't vary from browser to browser, so it will be down to the way different browsers handle the drawing of the elements. Without seeing your page in action it is not easy to suggest anything to help improve your situation.
Guys Got the Culprit here... :) :)
After doing lot of RnD on Server side and Client side, I took a look at "Developer Tool" in IE.
You can find something like "Document Mode: Quirks". If you check the Wiki page for this Quirks mode, You can find a definition as "In computing, quirks mode refers to a technique used by some web browsers for the sake of maintaining backward compatibility with web pages designed for older browsers, instead of strictly complying with W3C and IETF standards in standards mode."
So this all becuase of checking for compatibility for all components on page. And hence the performance issue. :)
And When I changed this mode to IE 8 Standard. Things started working really well.
IE and its issues ...!!!! :D

HTML 5 performance on Firefox?

I tried this sample here:
http://9elements.com/io/projects/html5/canvas/
After a few minutes, Firefox slows down so much I can't even popup any menu. When I closed the tab, Firefox comes back to normal again.
So is HTML 5 really a good choice now ?
it ran very well for me - both firefox and chrome, saying that - chrome was smooother, although you'd expect it with the weight of FF on your system.
But you bring up a good point. I've heard some people say Flash is dead and HTML5 is the new Flash - and I'm not sure how they consider the new HTML5 as a comparison.
I've also heard this is due to flash being closed and proprietary. But how does this differ than HTML5 in act?
Perhaps a little off topic but it is relative to the point, HTML5 is a wonderful magic and with it allows a greatly wanted upgrade to the now flagging HTML markup. It'll take some time before browsers catch up but thats only an issue now.
When was the last time HMTL got an upgrade? 97? 1998? so roughly 10 years since HTML caught up, so Browsers have 10 years toget to grips with HTML5
So ya. HTML5 is wonderful and I love and its good to get to know it, cus in 2 years - it'll be the standard.
Yes, now is the time for HTML5. Browser support is good and growing very quickly. The power of the average computer is such that creating web applications that implement the more resource intensive HTML5 features is perfectly reasonable.
Also, as a point of correctness, you can't use the smoothness of one company's HTML5 experiment as a way of validating whether HTML5 is ready for wider use. I could create a C program that would repeatedly print out "Hello World", and do it so badly that after 5 mins your entire system grinds to a halt. Does that mean C isn't ready yet?
You also have to remember that when new technologies first come in, there are no widely established "best practices" or cunning tricks to squeeze every last bit of performance out of the new features. Even if computers / browser weren't ready for HTML5 yet (which I think they are), it needs to be released, adopted, and it's use refined so that those best practice patterns can emerge.
What's your environment? I tried that page with Firefox 3.6.3 on a PowerBook G4/1.67GHz, 2G RAM (a nice laptop when I bought it six years ago, but hardly a powerhouse by today's standards) and it ran fine for several minutes with no performance issues whatsoever. It actually ran smoother than the typical youtube video does on this machine...

Resources