[erlang-questions] Hint erts to preallocate binary of required size

Max Lapshin max.lapshin@REDACTED
Fri Feb 22 20:44:00 CET 2013


I'm collecting now iolists and it takes a lot of time.


On Fri, Feb 22, 2013 at 11:18 PM, Dmitry Kolesnikov
<dmkolesnikov@REDACTED>wrote:

> Hello Max,
>
> > First problem: how can I understand if process copies these small chunks
> into heap or they are still subbinary?
>
>
> http://erldocs.com/R14B02/stdlib/binary.html?i=25&search=binary:#referenced_byte_size/1
>
> > Second idea: can it be a good idea to tell erts that I want to allocate
> new binary of 140 kbytes size and append small chunks to it with only one
> copying?
>
> May be you should use iolist instead of binary?
>
> - Dmitry
>
> On Feb 22, 2013, at 9:09 PM, Max Lapshin <max.lapshin@REDACTED> wrote:
>
> > erlyvideo has some problems with creating mpeg-ts from mp4.
> >
> > Problem is following: mp4 stores video frames in continuos blocks of 100
> kbytes. MPEG-TS requires to split this 100 kbytes into small chunks of
> about 180 bytes each.
> >
> > Right now it takes about 10 000 microseconds to generate one megabyte of
> mpeg-ts.
> >
> > First problem: how can I understand if process copies these small chunks
> into heap or they are still subbinary?
> >
> >
> > Second idea: can it be a good idea to tell erts that I want to allocate
> new binary of 140 kbytes size and append small chunks to it with only one
> copying?
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130222/4de0bf55/attachment.htm>


More information about the erlang-questions mailing list