Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Performance of delete on large arrays
(version: 0)
Benchmark.js
Comparing performance of:
50855 vs 50856
Created:
9 years ago
by:
Guest
Go to the latest result
Script Preparation code:
var N0 = 50855;
Tests:
50855
const N = N0; const o = {}; for ( let i = 0; i < N; i++ ) { o[i] = i; } for ( let i = 0; i < N; i++ ) { delete o[i]; }
50856
const N = N0 + 1; const o = {}; for ( let i = 0; i < N; i++ ) { o[i] = i; } for ( let i = 0; i < N; i++ ) { delete o[i]; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
50855
50856
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.6
View result in a separate tab
Embed
Embed Benchmark Result
50855
2K/s
50856
2K/s
View exact numbers
Test name
Executions per second
✓
50855
2,288 Ops/sec
50856
2,220 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's dive into the world of JavaScript microbenchmarks on MeasureThat.net. **What is tested?** The provided benchmark tests the performance of the `delete` operator on large arrays. The benchmark consists of two test cases: 1. Creating an array of length 50,555 (`N0`) and then deleting each element using a single `for...in` loop. 2. Creating an array of length `N0 + 1`, where `N0` is defined in the "Script Preparation Code" section, and then deleting each element using another `for...in` loop. **Options compared** The benchmark compares two approaches: 1. **Single delete loop**: This approach uses a single `for...in` loop to delete all elements from the array. 2. **Multiple delete loops**: In this approach, an additional `for...in` loop is used to delete each element individually, after the initial creation of the array. **Pros and cons** **Single delete loop:** Pros: * Efficient use of iterations (only one loop) * Potential for better cache locality Cons: * May not account for individual element deletion overhead * Can be slower due to loop optimization heuristics **Multiple delete loops:** Pros: * Accounts for individual element deletion overhead * Can provide a more accurate representation of the `delete` operator's performance Cons: * More iterations, potentially leading to cache thrashing and decreased performance * May result in less efficient use of CPU resources **Library usage** The benchmark uses the V8 JavaScript engine (part of Google Chrome), which is a popular and widely-used JavaScript engine. The V8 engine is optimized for performance and provides a robust implementation of the `delete` operator. **Special JS features or syntax** There are no specific JS features or syntaxes being tested in this benchmark. However, it's worth noting that some older versions of JavaScript engines may have different behavior when dealing with array deletion. **Other alternatives** If you're interested in exploring alternative approaches to microbenchmarking, consider the following: * **Spiral**: A high-performance benchmarking framework for Node.js and other JavaScript environments. * **Benchmark-XX**: A lightweight, open-source benchmarking library specifically designed for testing JavaScript performance. * **js-benchmark**: Another popular benchmarking library for Node.js and browser-based tests. Keep in mind that the choice of benchmarking library or framework depends on your specific use case, target audience, and performance requirements.
Related benchmarks
Remove by splice vs copyWithin vs filter (numeric array)
Comments
Confirm delete:
Do you really want to delete benchmark?