[erlang-questions] Optimization help required: find 0,0,1 code in binary

Björn Gustavsson bgustavsson@REDACTED
Wed Feb 9 11:33:30 CET 2011

On Wed, Feb 9, 2011 at 8:53 AM, Max Lapshin <max.lapshin@REDACTED> wrote:
> Hi! I'd wish to remove NIF code from erlyvideo once and thus I want to
> try fix some bottlenecks.
> First is NAL start code lookup. H.264 video frames are packaged in
> byte stream where frames are divided either by 0,0,0,1 either by 0,0,1
> It is not very clear when should be used 4-bytes code or when is used
> 3-bytes, so everybody is looking for 3-bytes code and then checks if
> it is 4-byte code.

Have you read the section about matching binaries in
the Efficiency Guide?


The way you have structured your binary matching used to be
best way to do it before R12B (and is similar to the "DO NOT" example
in that section), but now it is the slowest way. Look at the "DO" example
and try to structure your matching in the same way. You can use the
bin_opt_info compiler option to print information about binary
optimizations being applied (or not applied).

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list