Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Base64 to Base64Url replaceAll vs split + join (with plusses and slashes)
(version: 0)
Comparing performance of:
split + join vs replaceAll
Created:
2 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src=''></script>
Script Preparation code:
const data = 'W3siaWQiOiIwMDAxIiwidHl+wZSI6ImRvbnV0IiwibmFtZSI6IkNha2UiLCJwcH+UiOjAuNTUsImJhdHRlcnMiOnsiYmF0dGVyIj/pbeyJpZCI6IjEwMDEiLCJ0eXBlIjoiUmVndWxhciJ9LHsiaWQiOiIxMDAyIiwidHlwZSI6IkNob2NvbGF0ZSJ9LHsiaWQiOiIxMDAzIiwidHlwZSI6IkJsdWViZXJyeSJ9LHsiaWQiOiIxMDA0IiwidHlwZSI6IkRldmlsJ3MgRm9vZCJ9XX0sInRvcHBpbmciOlt7ImlkIjoiNTAwMSIsInR5cGUiOiJOb25lIn0seyJpZCI6IjUwMDIiLCJ0eXBlIjoiR2xhemVkIn0seyJpZCI6IjUwMDUiLCJ0eXBlIjoiU3VnYXIifSx7ImlkIjoiNTAwNyIsInR5cGUiOiJQb3dkZXJlZCBTdWdhciJ9LHsiaWQiOiI1MDA2IiwidHlwZSI6IkNob2NvbGF0ZSB3aXRoIFNwcmlua2xlcyJ9LHsiaWQiOiI1MDAzIiwidHlwZSI6IkNob2NvbGF0ZSJ9LHsiaWQiOiI1MDA0IiwidHlwZSI6Ik1hcGxlIn1dfSx7ImlkIjoiMDAwMiIsInR5cGUiOiJkb251dCIsIm5hbWUiOiJSYWlzZWQiLCJwcHUiOjAuNTUsImJhdHRlcnMiOnsiYmF0dGVyIjpbeyJpZCI6IjEwMDEiLCJ0eXBlIjoiUmVndWxhciJ9XX0sInRvcHBpbmciOlt7ImlkIjoiNTAwMSIsInR5cGUiOiJOb25lIn0seyJpZCI6IjUwMDIiLCJ0eXBlIjoiR2xhemVkIn0seyJpZCI6IjUwMDUiLCJ0eXBlIjoiU3VnY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InR5cGU+iOiJDaG9jb2xhdGUifSx7ImlkIjoiNTAwNCIsInR5/cGUiOiJNYXBsZSJ9XX1d=='; data.replaceAll('+', '-').replaceAll('_', '/')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
split + join
replaceAll
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):
Based on the provided benchmark results, I will assume that you are asking about the performance of the `replaceAll` method. The first test result shows an execution count of 1,118,411.25 executions per second, which is a relatively high value. The second test result shows an execution count of 660,778.375 executions per second, which is lower than the first one. To make a generalization about the performance of the `replaceAll` method based on these two results, I would say that: * The `replaceAll` method seems to be performing relatively well, with high execution counts in both tests. * However, there may be some variation in performance between different browsers and operating systems. For example, the Yandex Browser 23 test shows a significantly higher execution count than the second test result for a different browser. * It's also worth noting that the `replaceAll` method's performance can depend on various factors such as the input data, data size, and other external conditions. If you are looking to improve the performance of the `replaceAll` method, I would suggest considering optimizing the implementation or using alternative methods, depending on your specific requirements.
Related benchmarks:
String.fromCharCode & btoa vs base64ArrayBuffer function FIXED
Split string -vs- string array access
String.fromCharCode & btoa vs base64ArrayBuffer function FIXED ON LARGE ARRAY
Base64 to Base64Url replaceAll vs split + join
Comments
Confirm delete:
Do you really want to delete benchmark?