Skip to content

Commit

Permalink
No need to make binary for enif_inspect_iolist_as_binary
Browse files Browse the repository at this point in the history
The naive idea was to ensure binary so nif should not need to
copy iolist as binary (it would take the already carated binary directly)
  • Loading branch information
zmstone committed Mar 21, 2020
1 parent 8a37816 commit 63a46b7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/kpro_batch.erl
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ encode_tx([FirstMsg | _] = Batch, Compression, FirstSequence,
, enc(int32, Count) % {Count, T8} = dec(int32, T7),
, EncodedBatch
],
Body1 = iolist_to_binary(Body0),
CRC = crc32cer:nif(Body1),
CRC = crc32cer:nif(Body0),
Body =
[ enc(int32, PartitionLeaderEpoch)
, enc(int8, Magic)
, enc(int32, CRC)
, Body1
, Body0
],
Size = iolist_size(Body),
[ enc(int64, FirstOffset)
Expand Down

0 comments on commit 63a46b7

Please sign in to comment.