couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filipe Manana (JIRA)" <j...@apache.org>
Subject [jira] Created: (COUCHDB-681) couch_util:encodeBase64 vs base64:encode
Date Thu, 04 Mar 2010 12:27:27 GMT
couch_util:encodeBase64 vs base64:encode
----------------------------------------

                 Key: COUCHDB-681
                 URL: https://issues.apache.org/jira/browse/COUCHDB-681
             Project: CouchDB
          Issue Type: Improvement
          Components: Infrastructure
         Environment: trunk and all other branches
            Reporter: Filipe Manana
         Attachments: base64-trunk.patch

Just noticed that OTP's base64:encode is about one order of magnitude faster than couch_util:encodeBase64:

fdmanana@core2duo:~/git/couchdb/bin$ ./couchdb -i
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:true]

Eshell V5.7.4  (abort with ^G)
1> Apache CouchDB 0.11.0bd318717-git (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.37.0>] Apache CouchDB has started on http://127.0.0.1:5984/

1> L = crypto:rand_bytes(1024 * 1024). 
<<10,238,241,237,52,176,52,252,99,133,199,63,177,68,141,
  24,225,251,115,187,34,143,152,253,150,170,9,122,0,...>>
2> 
2> timer:tc(couch_util, encodeBase64, [L]).
{368052,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}
3> timer:tc(couch_util, encodeBase64, [L]).
{361919,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}
4> timer:tc(couch_util, encodeBase64, [L]).
{361141,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}
5> 
5> timer:tc(base64, encode, [L]).
{91055,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}
6> timer:tc(base64, encode, [L]).
{107130,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}
7> timer:tc(base64, encode, [L]).
{96070,
 <<"Cu7x7TSwNPxjhcc/sUSNGOH7c7sij5j9lqoJegDoP07QyKeuCeMtWD7aXcW0junYH1csNda3F83owKQDw6D8pI+Ep0A231BD2sMEYF0XFkCW"...>>}


Same goes for base64:decode vs couch_util:decodeBase64

Therefore I supply a patch to do the switch.
It also allows us to short a little couch_util :)

I executed all tests, both Etap and JS, and everything is fine with the switch.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message