JavaScript script to test the speed of a user's graphics card in the browser? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

JavaScript script to test the speed of a user's graphics card in the browser?

Imagine I have a website where I have a "fastest graphics card" competition. Users click a button to have their graphics card tested. We test it by giving them, say, 100 problems, and seeing how many of those they can solve in 10 seconds. Now what's a problem? Well, I found some pages like this one: http://www.vizitsolutions.com/portfolio/webgl/gpgpu/ Basically, in WebGL you can take advantage of the parallel computing power of graphics cards. I realize there's more to the speed of a graphics card than the shading computation speed, but this is what we're going with. Problems should be easy to generate for the server, but hard to test for the client. Here's an example: 78 4 86 100 79 25 44 14 10 78 52 71 44 Problem: Do any combination of those numbers add up to exactly 300? Answer: Yes, these do: 78 4 79 14 10 71 44 (There may be other solutions too.) With enough numbers, it takes a long time (even for a computer) to find an answer, but checking an answer is valid is very fast. Now, this is just one example and I'm not sure if that is even possible in WebGL, but I'm looking for something like that where the server can quickly generate a lot of problems and the faster your graphics card is, the more problems your PC can solve in the time you're given. "Why don't you just draw something on the user's screen while measuring the FPS?" Because then it will take about 12 minutes before the first user edits the JavaScript code to just submit 999 FPS. It has to be a real test. :)

18th Feb 2017, 11:04 AM
Saurabh Tyagi
Saurabh Tyagi - avatar
1 Answer
+ 2
Not all browsers support GPU acceleration. However, if you are interested look for WebGL.
23rd Jan 2018, 1:44 PM
Lil Taco
Lil Taco - avatar