Bug 237789 - Web worker JS is too slow as compared to chrome
Summary: Web worker JS is too slow as compared to chrome
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-11 10:50 PST by tasnim
Modified: 2022-06-23 15:54 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tasnim 2022-03-11 10:50:04 PST
I am building a web app that relies on wasm + pthread (i.e. web workers) and noticed that it was super slow in safari as compared to chrome (nearly 10x slower). The issue could have been in wasm or web-worker but it seems its just the web worker being too slow in safari.

I ran following simple loop iterations in 3 browsers: safari, mozilla (98.0 (64-bit)) & chrome (99.0.4844.51, x86_64) and have the following results -

10^8 loop iteration:
chrome: ~100ms
safari: ~1.9 seconds
firefox: ~107 ms

10^9 loop iterations:
chrome: ~710ms
safari: ~17.99 seconds
firefox: ~969 ms

Repro steps:
Code: https://jsfiddle.net/9gfjo207/7/ - try to save the html file (call it: index.html) and JS (as worker.js) in one directory and run a python sever from terminal on the same directory (python3 -m http.server) and type in browser: localhost:8000/index.html. Keep the developer console opened and type: startWorker() and notice the above results in different browsers.
Comment 1 Radar WebKit Bug Importer 2022-03-11 16:44:29 PST
<rdar://problem/90187513>
Comment 2 tasnim 2022-03-12 22:25:53 PST
I did a bit more testing. I get different results each time but chrome & safari's time seem similar (at some times safari is even faster than chrome) on my macOS. I don't remember why safari was performing slower before when I initially filed this bug.

Please consider this bug as obsolete but would be helpful if anyone can point me to links related to any benchmark done on this. Thanks!