Webworker behaves very slow in Firefox

Hi,

I have a webworker that does read/write to IndexedDB and perform some searches using elasticlunr.js elasticlunr.com

In chrome
init web worker took 1.930 ms
Populating db… took 21.47 ms
webworker.js:209 Done reading from IndexedDB. took 7851 ms

When perform search
Search took 6.570 ms

In Firefox
init web worker took 0.2400 ms
Populating db… took 4.515 ms
webworker.js:209:3
Done reading from IndexedDB. took 7236 ms

However, when perform the same search
Search took 3482 ms

Any reason why it’s taking so much longer to perform the same search?

1 Like

It’s hard to say without a link to the actual page. Do you mind providing such a link?

Hi Boris,

Sure, I uploaded the test page on S3 https://widgets-dev.weather.com/universal/test.html
On S3 it’s much better comparing to localhost, but still an order of magnitude slower comparing to Chrome.

Chrome, search "winter storm"
Search took 11.01 ms
process took 13.92 ms

Firefox, search "winter storm"
Search took 822.3 ms
process took 1805 ms

Hi Boris,

Another thing I’m noticing when webworker is performing the search, the main ui thread is not responsive. That shouldn’t be the case.

Sorry for the lag; I finally got a chance to try this…

In my profile I see a huge amount of time being spent by console runnables due to a console.log() call from a worker that sends in what looks like a large object. What do the times look like if you don’t console.log() the search result?

1 Like

This link is without console.log of search result from webworker https://widgets-dev.weather.com/universal/test-no-console.html

The time is much better :slight_smile:

init web worker took 0.1700 ms
Populating db… took 7.200 ms
Done reading from IndexedDB. took 1944 ms
process took 36.99 ms
Worker said:
Search took 14.73 ms

compare to Chrome
init web worker took 0.7750 ms
Populating db… took 12.00 ms
Done reading from IndexedDB. took 1344 ms
Search took 13.95 ms
process took 38.74 ms
Worker said:

1 Like

Thank you! I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1424740 on this.

2 Likes