nickva opened a new pull request, #5644:
URL: https://github.com/apache/couchdb/pull/5644

   At some point Erlang/OTP didn't have direct *_to_binary, binary_to_* and 
similar functions, and we had to go through lists. Since now we have direct 
functions simplify some of the code to avoid redunant list conversions.
   
   It's mostly for readability, but in microbenchmarks it's also a bit faster:
   
   ```
   1> timer:tc(fun() -> lists:foreach(fun(_) -> 
list_to_binary(integer_to_list(123456789)) end, lists:seq(1, 1000000)) end).
   {1609116,ok}
   2> timer:tc(fun() -> lists:foreach(fun(_) -> 
list_to_binary(integer_to_list(123456789)) end, lists:seq(1, 1000000)) end).
   {1593957,ok}
   3> timer:tc(fun() -> lists:foreach(fun(_) -> 
list_to_binary(integer_to_list(123456789)) end, lists:seq(1, 1000000)) end).
   {1595424,ok}
   ```
   
   ```
   4> timer:tc(fun() -> lists:foreach(fun(_) -> integer_to_binary(123456789) 
end, lists:seq(1, 1000000)) end).
   {1014511,ok}
   5> timer:tc(fun() -> lists:foreach(fun(_) -> integer_to_binary(123456789) 
end, lists:seq(1, 1000000)) end).
   {961102,ok}
   6> timer:tc(fun() -> lists:foreach(fun(_) -> integer_to_binary(123456789) 
end, lists:seq(1, 1000000)) end).
   {971104,ok}
   ```
   


-- 
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-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to