On my dummy benchmark (I parsed fuzzing corpus files) these optimizations improve performance total up to 23%.
There's two good performance increasing optimizations.
Remove cloning as much as possible (commit 816531ed67dc6d4b8fb53d1f8a80ca6008e2e57a). This gave up to 17% improvement. I'm not really familiar with error-chain so I probably did something silly there.
Replace .filter(p).nth(0) with .find(p) from iterators (commit af771b8e6043af7d6d087f2581207bfd4c3228cb). This caught me by surprise, but showed up to 9% improvement. This was suggested by Clippy, so kudos to them!
On my dummy benchmark (I parsed fuzzing corpus files) these optimizations improve performance total up to 23%.
There's two good performance increasing optimizations.
Remove cloning as much as possible (commit 816531ed67dc6d4b8fb53d1f8a80ca6008e2e57a). This gave up to 17% improvement. I'm not really familiar with
error-chain
so I probably did something silly there.Replace
.filter(p).nth(0)
with.find(p)
from iterators (commit af771b8e6043af7d6d087f2581207bfd4c3228cb). This caught me by surprise, but showed up to 9% improvement. This was suggested by Clippy, so kudos to them!