Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
SLT for VR4300
(version: 0)
Implementation of SLT for n64. See https://github.com/hulkholden/n64js/commit/3daa584c40a8e04ed9d39abfcf64724c93fe61cf.
Comparing performance of:
Using Int32Array / Uint32Array vs Using BigIntArray
Created:
2 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
s64 = new BigInt64Array(new ArrayBuffer(24)); let bufHi = new ArrayBuffer(12); let bufLo = new ArrayBuffer(12); u32Lo = new Uint32Array(bufLo); u32Hi = new Uint32Array(bufHi); s32Lo = new Int32Array(bufLo); s32Hi = new Int32Array(bufHi);
Tests:
Using Int32Array / Uint32Array
let r = 0; if (s32Hi[1] < s32Hi[2]) { r = 1; } else if (s32Hi[1] === s32Hi[2]) { r = (u32Lo[1] < u32Lo[2]) ? 1 : 0; } s32Lo[0] = r; s32Hi[0] = 0;
Using BigIntArray
const r = s64[1] < s64[2] ? 1n : 0n; s64[0] = r;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Using Int32Array / Uint32Array
Using BigIntArray
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
**What is being tested:** The provided benchmark tests the performance of two approaches to compare integers in JavaScript: 1. Using `Int32Array`/`Uint32Array`: This approach uses 32-bit signed and unsigned integer arrays, respectively, to store the values to be compared. The comparison is performed using the `<` operator. 2. Using `BigInt64Array`: This approach uses a 64-bit signed integer array to store the values to be compared. The comparison is performed using the `<` operator. **Options being compared:** * The two approaches are compared in terms of performance, specifically the number of executions per second on various devices (Desktop and unknown). * There are no other options being tested in this benchmark. **Pros and Cons of each approach:** * **Using `Int32Array`/`Uint32Array`:** + Pros: - Familiar to most developers, as these arrays have been used for years. - May be more cache-friendly due to their smaller size. - Cons: - Limited range (-2147483648 to 2147483647 for `Int32Array`, and 0 to 4294967295 for `Uint32Array`). * **Using `BigInt64Array`:** + Pros: - Can handle larger integers, making it suitable for applications that require high precision. - Cons: - Less familiar to most developers, as these arrays are relatively new. - May be less cache-friendly due to their larger size. **Library and purpose:** In the provided benchmark code, two libraries are used: 1. `BigInt64Array`: This is a built-in JavaScript array type that represents a 64-bit signed integer. 2. No other libraries are used in this benchmark. **Special JS feature or syntax:** No special features or syntax are mentioned in the benchmark code. **Other alternatives:** If you need to compare large integers, using `BigInt` (the JavaScript number type) would be another alternative: ```javascript const r = s64[1] < s64[2] ? 1n : 0n; s64[0] = r; ``` However, keep in mind that `BigInt` is only supported in ECMAScript 2020 and later versions. In earlier versions of JavaScript, you would need to use a library or alternative approach. In general, if you need to compare small integers, using `Int32Array`/`Uint32Array` might be sufficient. If you need to compare larger integers, using `BigInt64Array` or `BigInt` would be more suitable.
Related benchmarks:
Uint(8/16/32)Array.set performance compare
JS number to UInt8Array 64-bit little endian
Uint(8/16/32)Array and BigInt64Array comparison performance
AND for VR4300
Comments
Confirm delete:
Do you really want to delete benchmark?