Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
nums unshorter
(version: 0)
Comparing performance of:
ations favorite vs Flo first try vs ations extends Flo vs ations tried something vs Flo favorite
Created:
4 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
String.prototype.fn1 = function() { const matched = this.match(/^((?:-|\+)?(?:\d+(?:\.\d+)?(?:e\d+)?|\.\d+(?:e\d+)?))([yzeptgmk]?)$/i) return matched ? matched[1] * { 0: 1, k: 1e3, m: 1e6, g: 1e9, t: 1e12, p: 1e15, e: 1e18, z: 1e21, y: 1e24 }[matched[2] || 0] : NaN } String.prototype.fn2 = function() { const reg = this.match(/^((?:-|\+)?(?:\d+(?:\.\d+)?(?:e\d+)?|\.\d+(?:e\d+)?))([yzeptgmk]?)$/i) return reg && (reg[1] * { k: 1e3, m: 1e6, g: 1e9, t: 1e12, p: 1e15, e: 1e18, z: 1e21, y: 1e24 }[reg[2]] || Number(reg[1])) } String.prototype.fn3 = function() { const [_, a, b] = this.match(/^((?:-|\+)?(?:\d+(?:\.\d+)?(?:e\d+)?|\.\d+(?:e\d+)?))([yzeptgmk]?)$/i) || [] return a ? a * { 0: 1, k: 1e3, m: 1e6, g: 1e9, t: 1e12, p: 1e15, e: 1e18, z: 1e21, y: 1e24 }[b || 0] : NaN } String.prototype.fn4 = function() { const matched = this.match(/^((?:-|\+)?(?:\d+(?:\.\d+)?(?:e\d+)?|\.\d+(?:e\d+)?))([yzeptgmk]?)$/i) return matched ? matched[1] * ({ k: 1e3, m: 1e6, g: 1e9, t: 1e12, p: 1e15, e: 1e18, z: 1e21, y: 1e24 }[matched[2]] || 1) : NaN } String.prototype.fn5 = function() { const [_, num, key] = this.match(/^(\d+(?:\.\d+)?|\.\d+)([kmgtpezy]?)$/i) || [] return num * { '': 1, k: 1e3, m: 1e6, g: 1e9, t: 1e12, p: 1e15, e: 1e18, z: 1e21, y: 1e24 }[key] }
Tests:
ations favorite
''.fn1() "abc".fn1() "1kk".fn1() "1.7kk".fn1() "1e3kk".fn1() "1.7e3kk".fn1() "1e3".fn1() "1e3k".fn1() "1.7e3k".fn1()
Flo first try
''.fn2() "abc".fn2() "1kk".fn2() "1.7kk".fn2() "1e3kk".fn2() "1.7e3kk".fn2() "1e3".fn2() "1e3k".fn2() "1.7e3k".fn2()
ations extends Flo
''.fn3() "abc".fn3() "1kk".fn3() "1.7kk".fn3() "1e3kk".fn3() "1.7e3kk".fn3() "1e3".fn3() "1e3k".fn3() "1.7e3k".fn3()
ations tried something
''.fn4() "abc".fn4() "1kk".fn4() "1.7kk".fn4() "1e3kk".fn4() "1.7e3kk".fn4() "1e3".fn4() "1e3k".fn4() "1.7e3k".fn4()
Flo favorite
''.fn5() "abc".fn5() "1kk".fn5() "1.7kk".fn5() "1e3kk".fn5() "1.7e3kk".fn5() "1e3".fn5() "1e3k".fn5() "1.7e3k".fn5()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
ations favorite
Flo first try
ations extends Flo
ations tried something
Flo favorite
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):
Let's break down what's being tested in this benchmark. **Benchmark Definition** The benchmark definition is a set of JavaScript functions (`fnX`) that take a string input and perform some operation on it, which is not explicitly shown in the code snippet. However, based on the test names and function calls, it appears that these functions are designed to convert strings from one format to another. **Test Functions** There are four test functions: 1. `fnX` (not specified): This is the base function that takes a string input. 2. `fn2`: This function is similar to `fnX`, but with some differences in its implementation. 3. `fn3`: This function is an extension of `fn2`. 4. `fn4`: This function attempts to do something different than the previous three. **Test Names** The test names suggest that these tests are comparing the performance of different string conversion approaches: 1. "ations favorite" vs. "Flo first try" 2. "ations extends Flo" 3. "ations tried something" (compared to the previous two) 4. "Flo favorite" **Latest Benchmark Results** The latest results show the execution frequency per second for each test on a specific device and browser configuration. Here's what we can infer: * The first three tests have similar performance, with `fnX` being the fastest. * `fn2` is slower than `fnX`, but faster than `fn3`. * `fn4` is significantly slower than the other three. * The tests are running on a Windows 10 desktop with Firefox 78 browser. **Implications** This benchmark suggests that: 1. String conversion can be a performance bottleneck in JavaScript applications. 2. Different approaches to string conversion have varying levels of performance impact. 3. Optimizing string conversion algorithms can lead to significant performance improvements. Overall, this benchmark provides insight into the relative performance of different string conversion approaches and highlights the importance of optimizing these operations in JavaScript applications.
Related benchmarks:
regexp n such
test regex vs loop
compare regex pattern
Alphanumeric String test 2
Regex tests Dani
Comments
Confirm delete:
Do you really want to delete benchmark?