[ejabberd] performance penalty with jlib:decode_base64/1 vs httpd_util:decode_base64/1

Oleg Palij o.palij at dp.uz.gov.ua
Sat Jul 21 20:38:43 MSD 2007

Hi, all!

I tried to decode photo from users vcard.
for example here is a one of the vcards - http://www.dp.uz.gov.ua/o.palij/ejabberd_users/saint.txt.bz2
it was taken with
[{vcard, _, VCard}]=mnesia:dirty_read(vcard, {"user", "server"}).
and then VCard was written to file.

the test:
1> {ok, [VCard]}=file:consult("saint.txt").
2> Photo64=xml:get_path_s(VCard, [{elem, "PHOTO"}, {elem, "BINVAL"}, cdata]).
3> {JLibTime, JLibRes}=timer:tc(jlib, decode_base64, [Photo64]).
4> {HTTPDTime, HTTPDRes}=timer:tc(httpd_util, decode_base64, [Photo64]).
5> JLibTime/1000000.
6> HTTPDTime/1000000.
7> JLibRes==HTTPDRes.

so, decode_base64 in jlib ~1300 times slower than in httpd_util on this vcard (134K), on 154K vcard this penalty was about 1500 times. This was on 2.80 GHz Celeron. I have this performance penalty on a different vcards and on a different ejabberd installations.
is it normal?

crossposted to ejabberd web forum.

ISC Pridn railway, System Administrator
e-mail: o.palij at dp.uz.gov.ua

More information about the ejabberd mailing list