jsperf

Which JS benchmark site is correct?

▼魔方 西西 提交于 2019-12-30 08:16:14
问题 I created a benchmark on both jsperf.com and jsben.ch, however, they're giving substantially different results. JSPerf: https://jsperf.com/join-vs-template-venryx JSBench: http://jsben.ch/9DaxR Note that the code blocks are exactly the same. On jsperf, block 1 is "61% slower" than the fastest: On jsbench, block 1 is only 32% slower than the fastest: ((99 - 75) / 75) What gives? I would expect benchmark sites to give the same results, at least within a few percent. As it stands, I'm unable to

Javascript performance of Array.map

隐身守侯 提交于 2019-12-22 01:58:37
问题 Just wrote up some test cases in jsperf to test the difference between named and anonymous functions while using Array.map and other alternatives. http://jsperf.com/map-reduce-named-functions (excuse the url name, there is no testing of Array.reduce in here, I named the test before fully deciding on what I wanted to test) A simple for/while loop is obviously the fastest, I'm still surprised by the more than 10x slower Array.map though... Then I tried the polyfill by mozilla https://developer

Impacts and benefits of creating empty object using Object.create(null)

时光总嘲笑我的痴心妄想 提交于 2019-12-12 08:01:22
问题 First of all, I made a quick jsperf test case to show the obvious : Object.create(null) is way slower than creating a object with the {} syntax. http://jsperf.com/js-object-creation-null-proto But given this fact, can the former case be a good alternative sometimes concerning optimization and performance? In other words, does manipulating the most lightweight js object can increase performance enough so that it became a reasonable choice to use it in some cases. I am refering to cases where

My JSPerf test case “breaks” while evaluating toggle() with callback

寵の児 提交于 2019-12-12 03:32:21
问题 While testing my answer to Adding HTML5 hidden attribute support to jQuery .toggle() method, I created a JSPerf test to determine how much slower .toggle(function() \[...\]) would be compared to .toggle(). To my amazement, the script with additional processing is reported to execute faster! Besides the results being counter-intuitive, I suspect a problem because I also see the toggling on the screen long after the results have returned. How can I "fix" my test to get accurate results? 回答1: I

Faster loop: foreach vs some (performance of jsperf is different than node or chrome)

本秂侑毒 提交于 2019-12-10 22:54:36
问题 Which is the best way to resume the value of an array into simple true or false values. I am quite confused as jsperf is giving me VERY different results than what google chrome console, nodejs, or any other JS engine gives me. (jsperf snippet here) This is the code snippet, and you can see (you can run it here) that some is like 100 times faster than using a foreach loop var array = []; var i = 0; var flag = false; while (i< 100000) { array.push(Math.random()*10000); i++; } console.time(

Function declaration speed difference in JS

流过昼夜 提交于 2019-12-07 11:37:02
问题 I ran a simple jsperf test and everything went as expected when running in Firefox but when I ran the test in Google Chrome is was confused. The test is testing different ways of declaring function in JavaScript and then calling them. My guess is that Chrome is doing some sort of optimization on the JavaScript function but I'm not sure what or why there is such a big difference. Any help or links to understand this better is greatly appreciated. Link to test => http://jsperf.com/function

Function declaration speed difference in JS

老子叫甜甜 提交于 2019-12-05 12:07:31
I ran a simple jsperf test and everything went as expected when running in Firefox but when I ran the test in Google Chrome is was confused. The test is testing different ways of declaring function in JavaScript and then calling them. My guess is that Chrome is doing some sort of optimization on the JavaScript function but I'm not sure what or why there is such a big difference. Any help or links to understand this better is greatly appreciated. Link to test => http://jsperf.com/function-assignment-semicolon/2 Test run in Firefox: Test in Chrome: Edit: I expected the results I got from Firefox

Explain this JsPerf.com result

蹲街弑〆低调 提交于 2019-12-03 17:39:20
问题 I ran a test on this website http://jsperf.com/ I want some one to explain What does green and pink signifies What is ops per second what is 95,814,583 what is +- 1.95% is whats does 'fastest' and 'slower' means 回答1: Hey, I’m the creator of jsPerf. The fastest test(s) get a green background. The slowest test(s) get a pink/red background. See below. It means the test can run about 95,814,583 times a second. ± 1.95 is the margin of error. (For more info, see below.) “fastest” means this is the

Large substrings ~9000x faster in Firefox than Chrome: why?

空扰寡人 提交于 2019-12-03 15:08:23
问题 The Benchmark: http://jsperf.com/substringing So, I'm starting up my very first HTML5 browser-based client-side project. It's going to have to parse very, very large text files into, essentially, an array or arrays of objects. I know how I'm going to go about coding it; my primary concern right now is getting the parser code as fast as I can get it, and my primary testbed is Chrome. However, while looking at the differences between substring methods (I haven't touched JavaScript in a long,

Large substrings ~9000x faster in Firefox than Chrome: why?

♀尐吖头ヾ 提交于 2019-12-03 04:53:50
The Benchmark: http://jsperf.com/substringing So, I'm starting up my very first HTML5 browser-based client-side project. It's going to have to parse very, very large text files into, essentially, an array or arrays of objects. I know how I'm going to go about coding it; my primary concern right now is getting the parser code as fast as I can get it, and my primary testbed is Chrome. However, while looking at the differences between substring methods (I haven't touched JavaScript in a long, long time), I noticed that this benchmark was incredibly slow in Chrome compared to FireFox. Why? My