[erlang-questions] Efficiency of splitting binaries

Richard Andrews bbmaj7@REDACTED
Wed Oct 24 15:27:54 CEST 2007


I'm looking for advice on efficiently splitting a binary into smaller chunks.

I currently use iolist_size() to check the size of the input binary then
recursively break off a chunk from the front with something like, eg.

    << ChunkData:30/binary-unit:8, RestData/binary >> = Data

... then use RestData as input to the next cycle.

Is this sensible? Are there more efficient approaches?
What effect does the binary-unit specifier have on performance? eg.

    ChunkData:1/binary-unit:240
versus
    ChunkData:240/binary



      Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage.
http://au.docs.yahoo.com/mail/unlimitedstorage.html




More information about the erlang-questions mailing list