Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
object-hash SHA-1 encoding 2
(version: 1)
Comparing performance of:
Object-hash hex vs Object-hash base64 vs Object-hash binary
Created:
2 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/object-hash@3.0.0/dist/object_hash.min.js"></script>
Script Preparation code:
var context1 = { title: 'fish', position: 1 } var context2 = { title: 'fish', position: 1 }
Tests:
Object-hash hex
objectHash(context1,{algorithm:'sha1',encoding:'hex'})
Object-hash base64
objectHash(context1,{algorithm:'sha1',encoding:'base64'})
Object-hash binary
objectHash(context1,{algorithm:'sha1',encoding:'binary'})
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Object-hash hex
Object-hash base64
Object-hash binary
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser/OS:
Chrome 123 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Object-hash hex
33991.8 Ops/sec
Object-hash base64
33096.5 Ops/sec
Object-hash binary
41060.8 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the benchmark and explain what's being tested. **What is being tested?** The provided JSON represents two benchmark definitions: `objectHash` and its usage with three different encoding options: `hex`, `base64`, and `binary`. The goal of this benchmark is to measure the performance of these three encoding options when hashing objects using the `objectHash` function. **What are the encoding options?** The encoding options being compared are: 1. **Hex**: Hexadecimal encoding, which represents binary data using 16 characters (0-9 and A-F) in a base-16 number system. 2. **Base64**: Base64 encoding, which represents binary data using a 64-character alphabet to encode binary data into a text format that can be safely transmitted over the internet. 3. **Binary**: Binary encoding, which simply returns the raw binary representation of the object without any additional formatting. **Pros and Cons of each approach:** 1. **Hex Encoding** * Pros: Fastest encoding option, requires less memory than base64 or binary. * Cons: Not human-readable, limited to 16 characters per byte. 2. **Base64 Encoding** * Pros: Human-readable, widely supported by web applications and protocols. However, it's slower than hex encoding due to the alphabet size (64 characters). * Cons: Requires more memory than hex or binary encoding, larger output size compared to hex encoding. 3. **Binary Encoding** * Pros: Fastest encoding option, requires minimal memory and processing power. * Cons: Not human-readable, requires additional processing to convert to a usable format. **Other considerations:** * The `objectHash` function is not defined in the provided code snippet, but it's likely a wrapper around a hashing algorithm like SHA-1. * The `context1` object is used as input for all three encoding options. It contains two properties: `title` and `position`, both with string values. **Alternative approaches:** Other alternatives to these encoding options could include: * **URL-safe base64**: A variant of Base64 that replaces the `/` and `+` characters with `_` and `-` characters, respectively. * **ASCII-safe base64**: Another variant of Base64 that uses only ASCII characters (A-Z, a-z, 0-9) to avoid issues with non-ASCII characters. * **Other hashing algorithms**, such as SHA-256 or MD5, which may offer better security properties than SHA-1 but are also typically slower. Overall, this benchmark seems to focus on measuring the performance of different encoding options for the `objectHash` function, with a mix of speed and memory considerations.
Related benchmarks:
object-hash vs stringify
21dsfsdfasdf
object-hash SHA-1 vs MD5 vs passthrough
object-hash SHA-1 encoding 2 excludeKeys hasOwnProperty fix
Comments
Confirm delete:
Do you really want to delete benchmark?