[
https://issues.apache.org/jira/browse/COUCHDB-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969343#action_12969343
]
Filipe Manana commented on COUCHDB-980:
---------------------------------------
Seems like erlang:phash2/1 is slightly faster:
Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe]
[kernel-poll:false]
Eshell V5.8.1 (abort with ^G)
1> crypto:start().
ok
2> Data = crypto:rand_bytes(8 * 1024).
<<16,140,225,70,15,147,93,220,103,134,3,164,133,141,199,
80,46,218,50,16,50,2,8,188,222,170,27,61,141,...>>
3>
3> timer:tc(crypto, md5, [Data]).
{80,
<<30,219,172,41,172,202,13,154,202,91,72,231,184,66,173,
155>>}
4> timer:tc(crypto, md5, [Data]).
{72,
<<30,219,172,41,172,202,13,154,202,91,72,231,184,66,173,
155>>}
5> timer:tc(crypto, md5, [Data]).
{73,
<<30,219,172,41,172,202,13,154,202,91,72,231,184,66,173,
155>>}
6>
6> timer:tc(erlang, phash2, [Data]).
{50,4852638}
7> timer:tc(erlang, phash2, [Data]).
{40,4852638}
8> timer:tc(erlang, phash2, [Data]).
{40,4852638}
9>
9> Data2 = crypto:rand_bytes(50 * 1024).
<<193,139,221,153,68,71,7,147,122,135,218,225,180,33,31,
222,215,248,23,120,138,230,166,167,205,108,89,110,33,...>>
10>
10> timer:tc(crypto, md5, [Data2]).
{377,
<<240,201,111,48,30,171,6,111,245,28,100,41,129,48,92,166>>}
11> timer:tc(crypto, md5, [Data2]).
{377,
<<240,201,111,48,30,171,6,111,245,28,100,41,129,48,92,166>>}
12> timer:tc(crypto, md5, [Data2]).
{379,
<<240,201,111,48,30,171,6,111,245,28,100,41,129,48,92,166>>}
13>
13> timer:tc(erlang, phash2, [Data2]).
{222,108981774}
14> timer:tc(erlang, phash2, [Data2]).
{222,108981774}
15> timer:tc(erlang, phash2, [Data2]).
{225,108981774}
16>
> Micro optimization to couch_file
> --------------------------------
>
> Key: COUCHDB-980
> URL: https://issues.apache.org/jira/browse/COUCHDB-980
> Project: CouchDB
> Issue Type: Improvement
> Components: Database Core
> Reporter: Filipe Manana
> Assignee: Filipe Manana
>
> The following short patch moves the MD5 verification outside the couch_file
> server:
> https://github.com/fdmanana/couchdb/commit/51c463d682c478dcb273bd88f1ef3046a709689f
> Despite being apparently so insignificant (couch_util:md5/1 takes about 700us
> in my machine), I get this significant results with relaximation:
> $ node tests/compare_write_and_read.js --wclients 100 --rclients 200 \
> -name1 md5_out -name2 trunk \
> -url1 http://localhost:5984/ -url2 http://localhost:5985/ \
> --duration 120
> run 1)
> http://graphs.mikeal.couchone.com/#/graph/5c859b3e7d1b9bd0488cfe271105130c
> run 2)
> http://graphs.mikeal.couchone.com/#/graph/5c859b3e7d1b9bd0488cfe2711051bba
> The documents used in the test have a size of about 1Kb.
> If nobody has an objection, I'll commit this to trunk.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.