You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/06/18 15:50:21 UTC
[GitHub] [couchdb] nickva commented on a diff in pull request #4071: Compiler warnings fixes
nickva commented on code in PR #4071:
URL: https://github.com/apache/couchdb/pull/4071#discussion_r900976218
##########
src/mem3/src/mem3.erl:
##########
@@ -323,8 +323,8 @@ range(#ordered_shard{range = Range}) ->
Range;
range(<<"shards/", Start:8/binary, "-", End:8/binary, "/", _/binary>>) ->
[
- httpd_util:hexlist_to_integer(binary_to_list(Start)),
- httpd_util:hexlist_to_integer(binary_to_list(End))
+ list_to_integer(binary_to_list(Start), 16),
Review Comment:
We could even go a tiny bit faster by using `binary_to_integer/2`
```
./erlperf 'httpd_util:hexlist_to_integer(binary_to_list(<<"abc123def980">>)).' 'binary_to_integer(<<"abc123def980">>, 16).' --samples 10 --warmup 2
Code || QPS Time Rel
binary_to_integer(<<"abc123def980">>, 16). 1 28289 Ki 35 ns 100%
httpd_util:hexlist_to_integer(binary_to_list(<<"abc123def980">>)). 1 20880 Ki 47 ns 73%
```
--
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: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org