Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript performance by processor type

I'm wondering if anyone is aware of a tool or database that will give me relative javascript performance based on processor type. I'm trying to make a case to my boss that we need to improve performance on some of our webpages. These pages run fine on all the high end hardware we have around the office, but my suspicion is that our user base has far more performance problems that are being dismissed. My goal is to show something like:

i7 @ 3.8ghz - completes javascript benchmark X in 1 minutes
i5 @ 2.2ghz - completes javascript benchmark X in 2 minutes
i3 @ 1.6ghz - completes javascript benchmark X in 4 minutes

I don't have the hardware to run these tests myself, but with a small library of relative performance based on processor, I figure I can extrapolate out. Thanks!

PS - I realize that many factors going into js performance, but I'd like something that has been isolated to processor speed as it is a limiting factor in my particular use case.

like image 572
mrtsherman Avatar asked Apr 24 '14 19:04

mrtsherman


1 Answers

I've been searching for an answer for your question. There is jsperf.com that contain many javascripts tests. Unfortunately, they only check on the browsertype and its performance. You can search for a test with many results, so you can get an indication of how well others have performed.

You can even make your own jsperf test and test it on other computers.

Note that results depend on many parameters:

  • what is the CPU?
  • which browser are you using? (jsperf even emphasizes on browsertype)
  • plugins/addons are active (if you have other javascript heavy scripts currently on)
  • operating system
  • system memory (if you have GB ram the computer can dump anything without the necessity to swap.
  • other programs that are using the CPU at the moment

specs:

Firefox 28
Windows 7, 64bit
AMD Phenom II x4, 2.8Ghz

I've ran this jsperf test: http://jsperf.com/native-vs-array-js-vs-underscore/8.

native
    672,225 ±8.17%fastest
array.js
    663,733 ±7.74%0.87% slower
underscore
    622,637 ±7.96%7% slower
lo-dash
    552,168 ±7.28%17% slower

I also found sunspider: https://www.webkit.org/perf/sunspider/sunspider.html It gives results about how well your hardware (and software) have performed on the test. You could try the test on your computer and on your boss' computer to get an indication. Here's mine:

============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                  285.1ms +/- 16.7%
--------------------------------------------

  3d:                    45.7ms +/- 4.9%
    cube:                16.2ms +/- 8.0%
    morph:                9.7ms +/- 3.6%
    raytrace:            19.8ms +/- 5.6%

  access:                20.2ms +/- 3.3%
    binary-trees:         3.1ms +/- 7.3%
    fannkuch:             8.4ms +/- 4.4%
    nbody:                4.2ms +/- 7.2%
    nsieve:               4.5ms +/- 8.4%

  bitops:                14.3ms +/- 4.7%
    3bit-bits-in-byte:    1.3ms +/- 26.6%
    bits-in-byte:         4.5ms +/- 8.4%
    bitwise-and:          2.0ms +/- 0.0%
    nsieve-bits:          6.5ms +/- 5.8%

  controlflow:            2.6ms +/- 14.2%
    recursive:            2.6ms +/- 14.2%

  crypto:                21.9ms +/- 6.4%
    aes:                 10.0ms +/- 10.7%
    md5:                  6.7ms +/- 5.2%
    sha1:                 5.2ms +/- 5.8%
  date:                  36.7ms +/- 30.1%
    format-tofte:        15.1ms +/- 3.5%
    format-xparb:        21.6ms +/- 50.9%
  math:                  22.7ms +/- 3.0%
    cordic:               4.9ms +/- 4.6%
    partial-sums:        15.0ms +/- 3.2%
    spectral-norm:        2.8ms +/- 10.8%
  regexp:                14.8ms +/- 4.4%
    dna:                 14.8ms +/- 4.4%

  string:               106.2ms +/- 46.4%
    base64:               9.8ms +/- 9.6%
    fasta:               10.8ms +/- 5.2%
    tagcloud:            24.3ms +/- 6.7%
    unpack-code:         30.4ms +/- 10.9%
    validate-input:      30.9ms +/- 150.4%

I hope this information gives an answer to your quest. If not, i will remove it. Good luck!

like image 120
Kai Avatar answered Nov 14 '22 14:11

Kai