lzaeh opened a new pull request, #2246: URL: https://github.com/apache/fury/pull/2246
… replace auto with explicit types; optimize implementation <!-- **Thanks for contributing to Fury.** **If this is your first time opening a PR on fury, you can refer to [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).** Contribution Checklist - The **Apache Fury (incubating)** community has restrictions on the naming of pr titles. You can also find instructions in [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md). - Fury has a strong focus on performance. If the PR you submit will have an impact on performance, please benchmark it first and provide the benchmark result here. --> ## What does this PR do? This PR fixes several minor issues and improves the implementation of string utility benchmarks: - Corrected reversed function parameters. - Fixed an incorrect function call. - Replaced some usages of auto with explicit types for better readability and maintainability. - Refactored random number generation by encapsulating std::mt19937 in a thread-local helper function. One part of the original code used default random generation methods, which could result in uneven value distributions and non-deterministic behavior across platforms. To improve randomness quality and thread-safety, I replaced it with a `thread_local` encapsulated `std::mt19937` generator. This ensures better reproducibility and consistency during benchmarking. After these changes, the code compiles and runs correctly. Benchmark results are stable and as expected. (See image below.) <img width="842" alt="Screenshot 2025-05-19 at 17 24 58" src="https://github.com/user-attachments/assets/ddd329c4-ba14-4c9d-9fb1-ee4584c188b5" /> <!-- Describe the purpose of this PR. --> ## Related issues - #2245 <!-- Is there any related issue? Please attach here. - #xxxx0 - #xxxx1 - #xxxx2 --> ## Does this PR introduce any user-facing change? <!-- If any user-facing interface changes, please [open an issue](https://github.com/apache/fury/issues/new/choose) describing the need to do so and update the document if necessary. --> - [x] Does this PR introduce any public API change? - [x] Does this PR introduce any binary protocol compatibility change? ## Benchmark <!-- When the PR has an impact on performance (if you don't know whether the PR will have an impact on performance, you can submit the PR first, and if it will have impact on performance, the code reviewer will explain it), be sure to attach a benchmark data here. --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
