[erlang-questions] [ANN] io_libc -- fast formatting NIF

Danil Zagoskin <>
Sun Mar 9 20:56:22 CET 2014


1. We didn't know about these functions.
2. There is no erts_asprintf, so we need to guess the length of output
buffer
3. Files in this directory are *not* for public use and should *only* be
used by Erlang/OTP applications. The content of this directory and the
interfaces present in this directory may be changed at any time without
prior notice.


2014-03-09 23:38 GMT+04:00 Anthony Ramine <>:

> What about hooking up into erts_*printf?
>
> --
> Anthony Ramine
>
> Le 9 mars 2014 à 20:25, Danil Zagoskin <> a écrit :
>
> > Hello!
> >
> > This is io_libc: https://github.com/maxlapshin/io_libc
> > It was created to speedup massive CSV generation but may be useful for
> other purposes.
> >
> > io_libc provides an erlangish interface to standard C printf().
> >
> > It has very poor protection from malformed input, falling back to zeroes
> and empty strings, but it is very fast.
> >
> > Some examples:
> >
> > erl> io_libc:format("hello, %08.3f, %s %04X!", [3.14, dead, 48879]).
> > <<"hello, 0003.140, dead BEEF!">>
> >
> > erl> io_libc:format("%*.*f; %0*d", [8, 3, 2.7, 6, 12]).
> > <<"   2.700; 000012">>
> >
> > --
> > Danil Zagoskin | 
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 
---------------------------------------------
Данил Загоскин | +7 906 064 20 47 | 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140309/eb3f81af/attachment.html>


More information about the erlang-questions mailing list