13 ms·
Gpu.js – GPU Accelerated JavaScript
- KingFelix 8y agoI went to Plaid!
- na85 8y agoHow can I block this so that websites aren't mining crypto on my system? Is it a matter of blocking js entirely or is there a way to achieve a bit finer granularity?
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- inetknght 8y agoI use Firefox + uMatrix to selectively enable javascript for specific sites; otherwise javascript is strictly disabled for most sites.
- staticassertion 8y agouMatrix also allows you to whitelist web workers, which are a typical component for js crypto mining
- inetknght 8y agoWhich column do those fall under? I see cookie/css/image/media/script/xhr/frame/other. I assumed they're under web workers but, me not being a web developer, am not sure. I absolutely 100% do not want web workers (service workers?) enabled in any way shape or form. Any website which uses one is, in my opinion, not only extremely poorly designed but uses anti-patterns.
- jerrysievert 8y ago> I absolutely 100% do not want web workers (service workers?) enabled in any way shape or form. Any website which uses one is, in my opinion, not only extremely poorly designed but uses anti-patterns. that's kind of an unfair statement. web workers are extremely useful for moving computation away from the (single) gui thread, allowing the page to load and process large amounts of data without locking the main browser thread. what you're saying is equivalent to saying "any program that uses threads is poorly designed and uses anti-patterns". while, like threads, there can be bad uses for them, they can be used extremely effectively for good.
- inetknght 8y ago> what you're saying is equivalent to saying "any program that uses threads is poorly designed and uses anti-patterns". No, what I'm saying is that I want my web browser to have a light footprint. The browser from 10 years ago works perfectly fine: it rendered and displayed text and images and didn't require hundreds of megabytes or even gigabytes of disk space. The anti-pattern is the idea that so many new things are "needed".
- jerrysievert 8y ago> No, what I'm saying is that I want my web browser to have a light footprint. but that's not what you said (I'm not trying to be antagonistic) - you called using a specific part of the browser an anti-pattern and poorly designed. > The browser from 10 years ago works perfectly fine: it rendered and displayed text and images and didn't require hundreds of megabytes or even gigabytes of disk space. and alternately, the ed editor also works perfectly fine: it edited files, and is 57k (likely more than it needs to be). but for some reason most people don't use it very often, instead opting for vim, emacs, atom, or even eclipse. needing new things isn't an anti-pattern, it's simply the growth of the environment.
- inetknght 8y ago> but that's not what you said (I'm not trying to be antagonistic) - you called using a specific part of the browser an anti-pattern and poorly designed. You're right. Where do you think the statements contradict each other? I don't think they do. > and alternately, the ed editor also works perfectly fine: it edited files, and is 57k (likely more than it needs to be). but for some reason most people don't use it very often, instead opting for vim, emacs, atom, or even eclipse. As a matter of fact, I use vim a lot. > needing new things isn't an anti-pattern, it's simply the growth of the environment. From what problem did this need arise?
- Etheryte 8y agoThis paired with the recent web workers exploit [1] shows the direction malicious and pwned sites are very quickly moving. I think a good solution would be to implement resource control on domain level in browsers and give the user the ability to set the preferred values. [1] https://www.zdnet.com/article/new-browser-attack-lets-hackers-run-bad-code-even-after-users-leave-a-web-page/ https://www.zdnet.com/article/new-browser-attack-lets-hacker...
- untog 8y agoThat worker exploit doesn't make any sense, as written: > Technically, Service Workers are an update to an older API called Web Workers. However, unlike web workers, a service worker, once registered and activated, can live and run in the page's background, without requiring the user to continue browsing through the site that loaded the service worker. This isn't true. A service worker will be automatically shut down when it isn't attached to a browsing context. Not immediately, but it definitely doesn't support what the article describes.
- Etheryte 8y agoThis is covered in the article. > The attack routine consists of registering a service worker [...] and then abusing the Service Worker SyncManager interface to keep the service worker alive after the user navigates away.
- Kiro 8y agoWebminers normally don't use GPUs. They target algorithms like CryptoNight which are suitable for CPUs.
- aaaaaaaaaaab 8y ago*yet
- 9dev 8y agoIsn't it sad how that's one of the first things popping to mind when we talk about the web platform? I wonder if Berners-Lee ever anticipated how quick economic interests would ruin everything.
- graedus 8y agoWarning: this hard locked my MBP. More detail after I’m back at my machine. Edit: System details Retina Mid-2015 15" - MJLT2LL/A - MacBookPro11,5 - A1398 - 2910 Firefox 65.0.1 (64-bit) The hang occurred when running the benchmark with Texture Mode enabled. The spinning gear froze after a few seconds, then the display went black and the fan was maxed. It was a pain in the ass to recover: my only option seemed to be to power down and power back up again, at which point OSX helpfully remembered the state my machine was in and dropped me back into the blacked-out display and maxed fan. Some combination of NVRAM reset, SPC reset and safe mode was required to get back in.
- doctorpangloss 8y agoAs an MBP user, it's kind of funny the most dangerous thing I can do with my crazy expensive computer is use 100% of its resources in a sandbox.
- saagarjha 8y agoWell, you could load random kernel extensions you find on the internet…
- WrtCdEvrydy 8y agoThat's the spirit.
- diroussel 8y agoWorked ok on my iPhone Xs. GPU is x105 the speed of CPU according to this benchmark.
- coolspot 8y ago3-6 times faster on my iPhone X in the Chrome in texture mode, 1.2 times faster in default mode. 11 times faster in default mode in Safari, 5.5 times in texture mode. Results above are for battery-powered device, but repeating tests with charger plugged in didn't help to Chrome, but improved result for Safari up to 60 times. It looks like results vary significantly from time to time.
- lost_my_pwd 8y agoCaution: this just hung Firefox for a ~30s and then my MBP rebooted.
- redeemedfadi 8y agoSame here.
- angel_j 8y agoTensorflow.js is pretty good.
- peterkelly 8y agoI love this comment in the code: https://github.com/gpujs/gpu.js/blob/develop/src/backend/web-gl2/fragment-shader.js#L40 https://github.com/gpujs/gpu.js/blob/develop/src/backend/web... // Here be dragons! // DO NOT OPTIMIZE THIS CODE // YOU WILL BREAK SOMETHING ON SOMEBODY\'S MACHINE // LEAVE IT AS IT IS, LEST YOU WASTE YOUR OWN TIME
- banachtarski 8y agoAh yes, ye olde IEEE float to int conversion for ancient drivers that don't have good GPU integer support.
- gubbrora 8y agoI don't love it because let's say I really did want to change it, it doesn't tell me how much effort has previously gone into it and what happened. Maybe it means 10h have been spent in vain maybe 10000h. If I want to try my luck that's important.
- lprd 8y agoWelp, this blew up my 2017 MBP (10.14.3). Hanged after about 5 seconds of running.
- Twirrim 8y agoFirefox manages to be both significantly slower for CPU benchmark and significantly faster for GPU, compared to Chrome. The former gets me wondering what is going on with the javascript. Sure, v8 is usually faster than Firefox, but not 8x faster. Chrome GPU does it in 0.053s, where Firefox is hitting 0.005s, a tenth of the time. This is on a 2015 Mac Pro.
- taf2 8y agoIsn’t this due to security and process isolation differences? As in chrome does more to be secure than Firefox as far as how system resources are accessed via sandboxing?
- travisoneill1 8y agoThis is anecdotal, but when I built a JS image segmentation tool I found that FF was significantly faster than Chrome when working with the lower level stuff like ArrayBuffer, etc. I assume they are using a lot of this here since they are probably dealing with the WebGL API which needs to receive data as a buffer.
- blotter_paper 8y agoMaybe because FF started optimizing for asm.js earlier? Just an ignorant guess.
- masswerk 8y agoChrome was always significantly slower with typed arrays. I remember early benchmarks, where array buffers were actually slower than plain arrays (which also aligned with my own tests).
- kevingadd 8y agoChrome's GPU sandboxing is more aggressive, so it's probably performing extra copies. GPU round-trips (think synchronous operations like 'copy the result from the GPU back to CPU memory) also end up being slower due to the delays introduced by bouncing things between the page and the GPU sandbox.
- turdnagel 8y agoI used this for a simple implementation of Conway's Game of Life: https://turdnagel.com/cells/ https://turdnagel.com/cells/
- FlowNote 8y agoWill this solve the problem of my linter running Babel and its hundred plugins completely destroying my CPU just so I can get access to spreads?
- tyfon 8y agoFirefox on Arch Linux with a Vega 64 card + i7 4770k @ 3.5 ghz: CPU: 0.955s ±0.5% GPU: 0.003s ±4.3% (295.22 times faster!) Seems like decent speedup. It's a bit scary to have a web page have access to my GPU memory though, how does that work really? Does firefox clear the GPU memory before using it for tasks like this?
- politelemon 8y agoSimilar (FF + Ubuntu 1804, GTX 1080Ti, i7 4790K): CPU: 0.863s ±1.4% GPU: 0.003s ±4.0% (279.34 times faster!) I believe the library is using WebGL with buffers; browsers can make use of hardware for rendering and this library simply takes advantage of that
- jdashg 8y agoJust like JS clears CPU memory, webgl clears GPU memory before access.
- amelius 8y agoWhy do we need such hacks to access basic compute infrastructure?
- zapzupnz 8y agoSecurity, not only against bad actors but incompetent programmers having access to the inner workings of other people's machines. The idea is that nothing should normally need to access anything it doesn't actually require; so, in circumstances like this, developers need to go through a few extra hoops to help them engage in safest practices and not blow up other people's machines. Plus, different hardware, different abstractions, and the web has been relatively slow (and rightfully so) to open up access to this level of the computer until fairly recently. Lastly, JavaScript isn't batteries-included, so someone had to come up with this, and apparently it took until today for us to see the fruit of that labour.
- icebraining 8y agoCompiling is a hack now?
- kllrnohj 8y agoThe better question is why would you care? GPGPU has nearly no use outside of HPC applications, and nobody in that world is going to bother trying to make their supercomputer run Chrome. Otherwise for anything "GPGPU" in usage it tends to really just be "GPU" - like applying filters to images. That's just running a shader on a texture, it's something you can do quite naturally in WebGL already. GPGPU had a lot of buzz a few years back, but it's basically just a niche usage these days.
- maeln 8y agoGPGPU is definitely not having "no use outside of HPC". Almost any modern game engine that you use nowadays use GPGPU in some ways (for AI, Physics, some terrain processing, ...). GPGPU is also insanely popular in modern AI these days. Almost any AI framework has backend with CUDA or OpenCL. A lot of Offline renderer also use GPGPU nowadays. And this is just a few example that come to mind. The number of application that benefit from high-latency, high-throughput computations are plenty. Why do you think NVidia is still pushing and updating CUDA ? > Otherwise for anything "GPGPU" in usage it tends to really just be "GPU" It's like saying most turing-complete usage tend to be just "CPU". You can absolutely do GPGPU with just "normal" GPU usage. After-all, what is an array of data if not a texture ? A lot of processing are implemented this way: A texture and a pixel shader. But it doesn't mean that it is not GPGPU. GPGPU means that the GPU doesn't limit us to displaying polygons on the screen.
- terrortrain 8y agoIt would be interesting to compare some calculations between Gpu.js and https://js.tensorflow.org/ https://js.tensorflow.org/
- jingwen 8y agoI've built an animated raytracer with an early version of this. http://raytracer.crypt.sg/ http://raytracer.crypt.sg/
- techsin101 8y agoHow does one go about learning web gl
- tomlagier 8y agohttps://webgl2fundamentals.org/ https://webgl2fundamentals.org/ is a good resource, as is https://github.com/stackgl/shader-school https://github.com/stackgl/shader-school
- m3kw9 8y agoWhen will they have FPGA accelerated JavaScript?
- theblackcat1002 8y agothis is a joke right?
- numtel 8y agoGLSL isn't that much different syntax that Javascript. If you write it directly you get the fun of using types. And WebGL2's support of GLSL ES 3.0 brings features that make it much more handy for compute operations like bitwise operators. It's really not that complicated to write a compute function without any kind of library. Just throw up 2 triangles that cover the output and scale your canvas to the match the number of pixels you want to each 32 bits of output. See my proof of work generator for the Nano currency that implements the Blake2B hash using these techniques: https://github.com/numtel/nano-webgl-pow https://github.com/numtel/nano-webgl-pow Send data in as an array of integers on a uniform then receive data out as a bitmap encoded how you please.
- dtrailin 8y agoI've used this for a project and works pretty well. What's pretty incredible is that it was actually made a hackathon in Singapore. My main gripe I had this the debugging errors is very difficult if they happen in the graphics portion. Sometimes you will have to switch in the CPU mode which works differently the GPU mode, which means the results can be different for unknown reasons. Another annoyance (and this is more to do with web standards than anything) is that because a Canvas data is represented as RGBA in a single array any conversions to matrix form are very slow because any dimension past a certain size fails in GPU.js.
- throwaway66666 8y agoGPU 491 times faster. Something's iffy, but I love the idea.
- voltagex_ 8y ago250x faster than CPU on the Samsung Note 9, but what's really interesting is that it's 380x faster when I turn off all the power saving modes.
- shivkanthb 8y agoreally cool!
- elipsey 8y agoCrashed my tab real nice.
- ringaroll 8y agoWorks fine in Chrome. Crashes Firefox.
- anotherrobot 8y agoWARNING anyone trying. Crashed my MBP running 10.14.3 with FF 65.0.1. Lost some of my work
- sidcool 8y agoThis is pretty cool. I don't know its practical applications. Honestly I don't even care. It's just very nice to see such tinkering. Great job.
- AnnoyingSwede 8y agoDebian 9 x86_64/NVIDIA Corporation GK107 [NVS 510] hung like never before too.. Happend after clicking Enabled and running the test.