Created
May 26, 2012 17:22
-
-
Save maxlapshin/2794699 to your computer and use it in GitHub Desktop.
Benchmark of erlang json generation with jiffy library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(bm1). | |
| -compile(export_all). | |
| run() -> | |
| {ok, Bin} = file:read_file("sample.json"), | |
| Data = jiffy:decode(Bin), | |
| Count = 1000, | |
| List = lists:seq(1, Count), | |
| T1 = erlang:now(), | |
| [jiffy:encode(Data) || _N <- List], | |
| T2 = erlang:now(), | |
| Delta = timer:now_diff(T2,T1), | |
| io:format("~p us, ~p us per line~n", [Delta, Delta div Count]), | |
| ok. | |
| % 6> bm1:run(). | |
| % 20758446 us, 20758 us per line | |
| % ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment