[ 
https://issues.apache.org/jira/browse/HDDS-13516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika updated HDDS-13516:
-------------------------------
    Description: 
StringToSignProducer#urlEncode uses Strings#replaceAll that will call 
Pattern#compile for every invocation. This adds some memory overhead.

!image-2025-07-28-22-19-44-883.png|width=1109,height=169!

This can be improved by compiling the regex once. Please also add a simple 
microbenchmark (before and after the optimization) to prove that performance is 
indeed improved.

  was:
StringToSignProducer#urlEncode uses Strings#replaceAll that will call 
Pattern#compile for every invocation. This adds some memory overhead. 

 !image-2025-07-28-22-19-44-883.png! 

This can be improved by compiling the regex once. Please also add a simple 
microbenchmark (before and after the optimization) to prove that performance is 
indeed improved.


> Compile regex in StringToSignProducer#urlEncode once
> ----------------------------------------------------
>
>                 Key: HDDS-13516
>                 URL: https://issues.apache.org/jira/browse/HDDS-13516
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Ivan Andika
>            Priority: Minor
>         Attachments: image-2025-07-28-22-19-44-883.png
>
>
> StringToSignProducer#urlEncode uses Strings#replaceAll that will call 
> Pattern#compile for every invocation. This adds some memory overhead.
> !image-2025-07-28-22-19-44-883.png|width=1109,height=169!
> This can be improved by compiling the regex once. Please also add a simple 
> microbenchmark (before and after the optimization) to prove that performance 
> is indeed improved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to