Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How many threads do you think the browsers will allow on a single page?


As many as is needed. And as many processors as are needed. As someone who writes browser based 3D games, I need more power!


A web page should probably not be allowed to use unlimited amounts of computing power without asking for permission first.


I agree! Like 0xfeba pointed out, really annoying things like coinhive could eat all your CPU if no permission was required. Some sort of web API that tells the browser how many threads it can allocate for rendering and code execution. If the thread count exceeds a configured maximum the browser can ask the user for permission.


I don't see why the foreground web page shouldn't have as much access to my desktop's CPU as any native program.


eg coinhive


We need this!


I don't think it'll go that way, i remember when web workers first came out i wrote a simple raytracer with some GI and optionally used web workers if available for multiple threads. It worked fine until some browser updates later that limited the amount of web workers pages could use (or the amount of time each worker got, i don't remember, it has been a few years) making the web worker version have pretty much the same speed as the regular version.


That is disappointing to hear, I am hoping webassembly will loosen that back up a bit.


Out of curiosity, what technologies are you leveraging to write browser-based 3D games? Lightweight WebGL libraries, something higher-level like Unity, or something else entirely?


Rolling my own graphics engine (ugh!) to create a voxel octree platform. Front end uses C++ to Webassembly for the engine core and Typescript for the UX. Backend uses Java with a MSOA. All using a reactive message system.


Currently quite a lot, more than 10 with the current stable Firefox release, here's a test page: http://pmav.eu/stuff/javascript-webworkers/

(Web workers are around since ca. 2010 so this is not very new)


Do they require you to serialise data to strings or is it possible to transmit typed arrays?


There is support for efficiently passing data around. You can directly get binary typed arrays from XmlHttpRequest without intermediate processing, and you can pass them around without memory copies to WebWorkers using Transferables.

More recently you have shared typed arrays that work like shared memory between threads (as of Safari 10.1 / Chrome 60, Firefox too)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: