[erlang-questions] QR Code Generator
Ulf Wiger
ulf@REDACTED
Thu Oct 1 08:48:17 CEST 2015
On my Mac (2.5 GHZ Intel Core i7), using all cores, I get the same:
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
1> Data = list_to_binary(lists:duplicate(256,$x)).
<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"...>>
2> timer:tc(fun() -> lists:foreach(fun(_) -> QR = qrcode:encode(Data), qrcode_demo:simple_png_encode(QR) end, lists:seq(1,5)) end).
{1491915,ok}
If, OTOH, I do this:
3> PEval = fun(F,N) -> Ps = [spawn_monitor(fun() -> exit({ok,F()}) end) || _ <- lists:seq(1,N)], [receive {'DOWN',Ref,_,_,{ok,R}} -> R after 10000 -> error(timeout) end || {_,Ref} <- Ps] end.
#Fun<erl_eval.12.80484245>
4> timer:tc(fun() -> PEval(fun() -> QR = qrcode:encode(Data), qrcode_demo:simple_png_encode(QR) end, 5) end).
{357630, …}
Then, the performance seems to be really there. Is there something I’m missing, that they have to be generated sequentially?
BR,
Ulf
> On 01 Oct 2015, at 00:28, Tony Rogvall <tony@REDACTED> wrote:
>
> Data = list_to_binary(lists:duplicate(256,$x)).
> timer:tc(fun() -> lists:foreach(fun(_) -> QR = qrcode:encode(Data), qrcode_demo:simple_png_encode(QR) end, lists:seq(1,5)) end).
> {1401102,ok}
>
> The performance is nearly there ( running on my mac using only one core )
>
> /Tony
>
>> On 1 okt 2015, at 00:13, Theepan <vasdeveloper@REDACTED <mailto:vasdeveloper@REDACTED>> wrote:
>>
>> Team,
>>
>> I am in need of a QR code generator library for Erlang, to generate QR code PNG images of 256 alpha numeric characters.
>>
>> When I searched the Internet, I found one on GitHub. Have anyone of you used it? Do you have any recommendations?
>>
>> The performance I need is 5 QR code images generation per second.
>>
>> Thanks,
>> Theepan
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151001/9b7a6c50/attachment.htm>
More information about the erlang-questions
mailing list