jdarais commented on code in PR #139:
URL: https://github.com/apache/avro-rs/pull/139#discussion_r1990826409
##########
avro/src/ser_direct.rs:
##########
@@ -499,7 +498,7 @@ impl<'s, W: Write> DirectSerializer<'s, W> {
root_schema: schema,
names,
enclosing_namespace,
- schema_stack: Vec::new(),
+ schema_stack: Default::default(),
Review Comment:
Ah, interesting. It may be platform dependent, since I initially ran the
bench tests on Windows, but after running the tests on my Linux machine, I get
results consistent with yours.
I was a bit surprised to see that result, since the conventional wisdom is
that linked list is almost always worse than vector, since it ends up being
more spread out in memory, incurring a performance penalty simply from dealing
with CPU cache misses. Funny enough, looking again at the tests and the
`DirectSerializer` implementation, I don't think anything is ever stored in the
`schema_stack` field during the bench tests, since it is only used for unions
and type references, which aren't used in the bench test data. The linked list
is probably being measured as faster because it costs less to construct an
empty linked list vs an empty vector.
I may do another pass to see if I can improve the use of the `schema_stack`
field. If I can further improve the performance I'll submit another PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]