You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am working on reading Avro from BigQuery Storage API, the response from BigQuery creates a raw Avro binary output, the Reader implementation doesn't work since it expects the header to be present, so I turned to use from_avro_datum interface, however it killed the performance of the app, upon inspecting this, it turned out that this happens because it's resolving the schema multiple times, see the flamegraph below, but basically ResolvedSchema::try_from is 80.26% of the from_avro_datum call.
Can we expose another interface for from_avro_datum that takes in the ResolvedSchema object instead? Or maybe better, create a binary deserializer, in Java this works by using GenericDatumReader<>(schema) and creating a decoder with DecoderFactory.get().binaryDecoder
I am noticing another performance bottle neck this time when writing, it's spending most of the time validating the Value, can this be optional or sample based?
We could maybe add a Writer::unvalidated_append, then it is up to the user to ensure the Value is correct for the schema, or to sample their values by sending 1% via Writer::append.
We would not have to mark it unsafe, as the only consequence of using it wrong is writing invalid data.
We could maybe add a Writer::unvalidated_append, then it is up to the user to ensure the Value is correct for the schema, or to sample their values by sending 1% via Writer::append.
Sounds good!
Maybe behind a cargo feature that the user has to enable explicitly ?
Activity
Kriskras99 commentedon Oct 9, 2025
We are currently working on adding async support. Part of that work should make this easier.
In the meantime this is a workaround:
mina-asham commentedon Oct 9, 2025
Thank you, that's a great workaround for now!
mina-asham commentedon Oct 9, 2025
I am noticing another performance bottle neck this time when writing, it's spending most of the time validating the Value, can this be optional or sample based?
Kriskras99 commentedon Oct 9, 2025
Unfortunately this is currently not possible. This is again something that should be easier with the async work.
Kriskras99 commentedon Jan 25, 2026
We could maybe add a
Writer::unvalidated_append, then it is up to the user to ensure theValueis correct for the schema, or to sample their values by sending 1% viaWriter::append.We would not have to mark it
unsafe, as the only consequence of using it wrong is writing invalid data.@martin-g what do you think?
Kriskras99 commentedon Jan 25, 2026
@mina-asham if you're using Serde, using
Writer::append_seris a lot faster than doingto_valueand thenWriter::append.martin-g commentedon Jan 26, 2026
Sounds good!
Maybe behind a cargo feature that the user has to enable explicitly ?