[
https://issues.apache.org/jira/browse/ARTEMIS-5048?focusedWorklogId=935184&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-935184
]
ASF GitHub Bot logged work on ARTEMIS-5048:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Sep/24 14:15
Start Date: 18/Sep/24 14:15
Worklog Time Spent: 10m
Work Description: jbertram opened a new pull request, #5234:
URL: https://github.com/apache/activemq-artemis/pull/5234
This is the result I get from running the JMH benchmark locally:
```
Benchmark (length) Mode Cnt
Score Error Units
Base64Benchmark.benchmarkCustomBase64Decoding 1 avgt 10
128.219 ± 1.955 ns/op
Base64Benchmark.benchmarkCustomBase64Decoding 10 avgt 10
1093.527 ± 23.791 ns/op
Base64Benchmark.benchmarkCustomBase64Decoding 100 avgt 10
11144.289 ± 141.078 ns/op
Base64Benchmark.benchmarkCustomBase64Encoding 1 avgt 10
67.392 ± 0.983 ns/op
Base64Benchmark.benchmarkCustomBase64Encoding 10 avgt 10
564.470 ± 11.583 ns/op
Base64Benchmark.benchmarkCustomBase64Encoding 100 avgt 10
5901.252 ± 335.920 ns/op
Base64Benchmark.benchmarkJavaBase64Decoding 1 avgt 10
34.935 ± 1.856 ns/op
Base64Benchmark.benchmarkJavaBase64Decoding 10 avgt 10
97.194 ± 6.151 ns/op
Base64Benchmark.benchmarkJavaBase64Decoding 100 avgt 10
931.782 ± 35.235 ns/op
Base64Benchmark.benchmarkJavaBase64Encoding 1 avgt 10
37.814 ± 1.403 ns/op
Base64Benchmark.benchmarkJavaBase64Encoding 10 avgt 10
91.547 ± 1.620 ns/op
Base64Benchmark.benchmarkJavaBase64Encoding 100 avgt 10
907.458 ± 38.804 ns/op
```
The raw numbers aren't as important as the relative difference between the
Custom and Java implementations. The Java implementation provides better
performance and more consistency plus we get to eliminate around 1,600 lines of
code.
This is my first time using JMH so anybody with expertise please review and
provide feedback.
Issue Time Tracking
-------------------
Worklog Id: (was: 935184)
Remaining Estimate: 0h
Time Spent: 10m
> Use java.util.Base64
> --------------------
>
> Key: ARTEMIS-5048
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5048
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> We've traditionally used {{org.apache.activemq.artemis.utils.Base64}} for
> Base64 encoding/decoding. This implementation is based on public domain code
> from http://iharder.net/base64.
> In Java 8 {{java.util.Base64}} was introduced. I assumed we hadn't switched
> to this implementation for performance reasons so I created a simple
> JMH-based test to compare the two implementations and it appears to me that
> {{java.util.Base64}} is significantly faster than our current implementation.
> Using the JDK's class will simplify our code _and_ improve performance. Also,
> it should be 100% backwards compatible since Base64 encoding/decoding is
> standardized.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact