Commit d49f017
authored
Introduce a ThriftProtocolError to avoid allocating and formattings strings for error messages (#8636)
# Which issue does this PR close?
This is a small performance improvement for the thrift remodeling
- Part of #5853.
# Rationale for this change
Some of the often-called methods in the thrift protocol implementation
created `ParquetError` instances with a string message that had to be
allocated and formatted. This formatting code and probably also some
drop glue bloats these otherwise small methods and prevented inlining.
# What changes are included in this PR?
Introduce a separate error type `ThriftProtocolError` that is smaller
than `ParquetError` and does not contain any allocated data. The
`ReadThrift` trait is not changed, since its custom implementations
actually require the more expressive `ParquetError`.
# Are these changes tested?
The success path is covered by existing tests. Testing the error paths
would require crafting some actually malformed files, or using a fuzzer.
# Are there any user-facing changes?
The `ThriftProtocolError` is crate-internal so there should be no api
changes. Some error messages might differ slightly.1 parent a85d8b0 commit d49f017
1 file changed
+126
-65
lines changed
0 commit comments