2

I have a JavaScript application, which works fine, but certainly needs some memory / CPU performance (it is based on top of Google maps).

So basically it runs fine on a Desktop / Laptop PC, iPad works OK. But with all these different devices nowadays, smaller devices are definitely overloaded.

So basically I want to determine the available runtime and decide whether I start my JavaScript application, or display a message instead.

  1. OK, I could check the browser, but this is a never ending story
  2. I could check on the OS information, but again this is very tedious. Also some OS run on high performance devices as well as low end hardware.
  3. I could check on the screen size and rule out mobile phones, but then it gets difficult

So is there a way to determine the performance of the client? Just to make it clear, I do not care whether it is a tablet for instance, but if it is a low performance tablet with little CPU performance / memory (so Detect phone/tablet/web client using javascript does not help).

Community
  • 1
  • 1
Horst Walter
  • 12,873
  • 28
  • 104
  • 201
  • 3
    Maybe run a simple test/function that represents a basic level of functionality for your site; monitor the time it starts and the time it completes. Determine the duration and, based on that duration, decide whether it's running slow, normally or quickly? – David says reinstate Monica Mar 06 '13 at 23:53
  • I have tested the following: Measuring the time when the app starts and if a certain point is not reached after some given time, I stop. Unfortunately not very reliable, because of the nature of asynchronous calls and some hangers at the beginning (false alarm). Also the concept lacks the following, it checks "post" loading, and not upfront. But maybe I have to refine the checks. – Horst Walter Mar 07 '13 at 00:02
  • 1
    This has been asked at least a few times before (such as [here](http://stackoverflow.com/questions/4734518/whats-the-best-way-to-determine-at-runtime-if-a-browser-is-too-slow-to-graceful)). I'm not voting to close as a duplicate yet since the existing answers are old (things change) and not very satisfactory; also, you have thrown in a few new factors (Google Maps, testing on the iPad). – Tim Medora Mar 07 '13 at 01:06
  • But this gives my an idea Tim, I will check on JavaScript benchmarks and see if I can derive something from those. – Horst Walter Mar 07 '13 at 01:10
  • you could use java or something like that to do this, but i don't think it is possible in javascript. – markasoftware Mar 07 '13 at 02:05
  • Practical impossible, especially as such languages are not running on the weaker systems. An due to the security issues in the last time, many users do have Java disabled. – Horst Walter Mar 07 '13 at 09:22

1 Answers1

1

In javascript You could check list of features and based on that do conclusion if device is low memory.

For example:

  1. Check core count with window.navigator.hardwareConcurrency (For better coverage add Core Estimator polyfill)

  2. Check WebGL support (I like user2070775 suggestion): Proper way to detect WebGL support?

  3. Check if its desktop or mobile. Most likely desktop will not have any problems with memory.

  4. Check resolution of screen - most likely small resolution will be on low memory devices.

Community
  • 1
  • 1
Nick Bristol
  • 64
  • 1
  • 3