4 ms·
The "maybe you don't need a linked list" proposal at the bottom seems significantly better than the options presented in the post: - almost no cost in the non-
by evmar 2y ago
The "maybe you don't need a linked list" proposal at the bottom seems significantly better than the options presented in the post:
- almost no cost in the non-erroring path
- no extra data structures to manage
- a lot less code
I think the post would benefit from a better analysis of why this doesn't work for them.
- vouwfietsman 2y agoIndeed, also building a linked list over the stack like that is a crafty but very weird design. Keep it simple.
- dmitry_dygalo 2y agoIndeed, I agree with your points. This idea was added after I wrote the post and wasn't taken from my own optimization efforts in `jsonschema`. Originally, in `jsonschema` the output type is actually a badly composed iterator and I intended to simplify it to just a `Result<(), ValidationError>` for the article, but with this output, there are actually way better optimizations than I originally implemented. If I'd discovered this idea earlier, I'd probably spend more time investigating it.