Replace the old Posison.Decode.decode/2 with Bento.Decoder.transform/2.
As you can see, the benchmark shows that there is no obvious difference in performance.
Earlier times:
## ParserBench
benchmark name iterations average time
single (Bencodex) 500000 4.02 µs/op
single (Bento) 500000 6.36 µs/op
single (bencode) 100000 16.51 µs/op
multi (Bencodex) 5000 666.52 µs/op
multi (Bento) 1000 1110.96 µs/op
single (bencoder) 1000 1276.72 µs/op
multi (bencode) 1000 1941.72 µs/op
multi (bencoder) 500 7130.18 µs/op
Nowadays:
## ParserBench
benchmark name iterations average time
single (Bencodex) 500000 4.24 µs/op
single (Bento) 500000 6.36 µs/op
single (bencode) 100000 14.28 µs/op
multi (Bencodex) 2000 603.69 µs/op
multi (Bento) 1000 1148.87 µs/op
single (bencoder) 1000 1511.96 µs/op
multi (bencode) 1000 1732.82 µs/op
multi (bencoder) 500 6760.21 µs/op
At this stage, I need to write some additional unit tests and documents to check if I have missed anything.
Replace the old
Posison.Decode.decode/2
withBento.Decoder.transform/2
.As you can see, the benchmark shows that there is no obvious difference in performance.
Earlier times:
Nowadays:
At this stage, I need to write some additional unit tests and documents to check if I have missed anything.
Moreover, I encapsulated
Bento.Parser
by the way.