Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array vs float64 for io and slice (fixed)
(version: 0)
Comparing performance of:
array slice vs typedArray slice vs array i/o vs typedArray i/o
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } var a = [...Array(10000)].map(_ => Math.random(1000000)); var ta = (new Float64Array(10000)).map(_ => Math.random(1000000));
Tests:
array slice
a.slice(0);
typedArray slice
ta.slice(0);
array i/o
for (let i = 0; i < 10000; ++i) { a[i] = a[i] + 1; }
typedArray i/o
for (let i = 0; i < 10000; ++i) { ta[i] = ta[i] + 1; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
array slice
typedArray slice
array i/o
typedArray i/o
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser/OS:
Firefox 132 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
array slice
32700.3 Ops/sec
typedArray slice
37947.1 Ops/sec
array i/o
114456.4 Ops/sec
typedArray i/o
193541.1 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
**Overview** The provided JSON represents a benchmark test case created on MeasureThat.net, a website where users can create and run JavaScript microbenchmarks. The test compares the performance of arrays and TypedArrays in various operations. **Benchmark Definition** The benchmark definition is represented by two JSON objects: 1. **"Name": "array vs float64 for io and slice (fixed)"**, which describes the overall purpose of the benchmark. 2. **Individual test cases**: Each test case has a unique name, a benchmark definition, and an optional script preparation code or HTML preparation code. **Test Cases** There are four individual test cases: 1. **"array slice"`**: Tests the performance of slicing arrays using the `slice()` method. 2. **"typedArray slice"`**: Tests the performance of slicing TypedArrays using the `slice()` method. 3. **"array i/o"`**: Tests the performance of iterative input/output operations on arrays, where each element is incremented by 1. 4. **"typedArray i/o"`**: Tests the performance of iterative input/output operations on TypedArrays, where each element is incremented by 1. **Options Compared** The benchmark compares two options: * **Arrays**: + **Pros**: Arrays are a built-in JavaScript data structure and have better support for various methods. + **Cons**: Arrays may have slower performance due to their dynamic nature and memory management overhead. * **TypedArrays**: + **Pros**: TypedArrays are optimized arrays that provide better performance, especially when working with large datasets or numerical computations. They also offer type safety and can reduce memory usage compared to regular arrays. + **Cons**: TypedArrays may require additional setup and configuration, and their support for certain methods is limited. **Library Usage** In the provided benchmark definition, no external libraries are used. However, in some test cases, JavaScript built-in functions like `Array.prototype.slice()` and `Float64Array` are used. **Special JS Features or Syntax** No special JavaScript features or syntax (e.g., async/await, promises) are used in this benchmark. The focus is on comparing the performance of arrays and TypedArrays. **Other Alternatives** If you need to create similar benchmarks for other operations or data structures, consider using MeasureThat.net's website or alternatives like: * Microbenchmarking libraries like `micro-benchmark` or `Benchmark.js` * Online platforms like Google's `jsperf` (now deprecated) or Mozilla's `SpiderMonkey Tuner` Keep in mind that each platform has its strengths and weaknesses, and some might be better suited for your specific use case.
Related benchmarks:
array vs float32array without conversion
array vs float32array without conversion 2
array vs float64 for io and slice
array vs float32array max
Comments
Confirm delete:
Do you really want to delete benchmark?