Is it possible to compare user system with javascript in browser?

As HTML5 begins to gain momentum, we see more experimentation with things like a video element or canvas.

When conducting an experiment with a canvas, for example, creating a firework with particles, 1000 particles can work well on a modern machine, but can move very slowly on a 3yr machine.

In any case, to check the user system, to dynamically change the experiment with the canvas (or something else), in order to optimize it for the specified specific user.

EDIT: Maybe this is the best solution: http://benchmarkjs.com/

+6
source share
4 answers

Measure the time it takes to render multiple frames from what you are doing, and adjust the level of detail accordingly. If you don't mind changing parts on the fly, you can use continuous measurements.

What you do not want to do is force your user to sit through a five minute test before they can do anything with your thing.

+8
source

FutureMark "Controller Peacekeeper" pretty much does it already. I think he is testing some other things, but he also does heavy benchmarking.

I assume that you can develop some kind of test that measures the frame rate on the canvas for the user, and then adjusts the details based on this. This can be done by setting a short interval and visualizing things on the canvas, and then using Date objects at each iteration until the time it took, and calculating the average frame rate based on this.

+2
source

EDITOR: Oops ... read the question too fast. My answer does not really apply.


Depending on the level of accuracy you want.

If you do not want something ultra-precise, it may be possible with a little work.

The way I see it; one of your biggest problems will be to consider different JS engines in different browsers and measure everything according to that particular browser and engine base.

For example, try running any SunSpider test in IE 5.5 and then in Google Chrome on the same machine ... an amazing difference. You must take this into account. http://www.webkit.org/perf/sunspider/sunspider.html

Ideally, you will also need to compare scores between different browsers (i.e. this test runs in x ms on machine A in IE 6 and in y ms on the same machine in IE 8, so I can match IE 6 points to IE points 8 using the average factor). It may be difficult to get enough data to work efficiently.

+2
source

It should be pretty simple. Just keep the frame counter and elapsed time in any function that updates your canvas and dividing the first by the last to get FPS. You can reduce the number of particles / samples / etc. dynamically based on FPS. So basically, yes, but that’s completely custom.

+2
source

Source: https://habr.com/ru/post/891499/


All Articles