Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test intArrya
(version: 1)
Comparing performance of:
obj vs uint8 vs bas level
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
obj
const splitArray = (arr) => { const displayed= []; const more= []; for (let i = 0; i < arr.length; i++) { if (i < 2) { displayed.push(arr[i]); } else { more.push(arr[i]); } } return { displayed, more }; }; const splitSelectedFilters = splitArray([1, 2, 3, 4, 5, 6]);
uint8
function splitUint8Array(arr) { const len = arr.length; // Si moins de 2 éléments, on gère les cas courts if (len <= 2) { return [arr.slice(0, len), new Uint8Array(0)]; } // Sinon, on divise normalement return [arr.slice(0, 2), arr.slice(2)]; } // Exemple d'utilisation : const input = new Uint8Array([1, 2, 3, 4, 5, 6]); const [displayed, more] = splitUint8Array(input);
bas level
function splitUint8ArrayManual(arr) { const len = arr.length; const firstLength = Math.min(2, len); const secondLength = len > 2 ? len - 2 : 0; const displayed = new Uint8Array(firstLength); const more = new Uint8Array(secondLength); for (let i = 0; i < firstLength; i++) { displayed[i] = arr[i]; } for (let i = 0; i < secondLength; i++) { more[i] = arr[i + 2]; } return [displayed, more]; } // Exemple : const input = new Uint8Array([1, 2, 3, 4, 5, 6]); const [displayed, more] = splitUint8ArrayManual(input);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
obj
uint8
bas level
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
obj
30377208.0 Ops/sec
uint8
8696616.0 Ops/sec
bas level
10824646.0 Ops/sec
Related benchmarks:
Assigning new variable
Test array concat
Test array concat with larger array
Hihihihi
Pushing
For vs Foreach manu
set vs uniq
Test direct and destructuring performances
Array length to string 1
Comments
Confirm delete:
Do you really want to delete benchmark?