-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit optimizers the writer in the CSV crate. In particular, it adds a fast pass that completely bypasses the CoreWriter from csv-core. It's faster because the csv-core (necessarily) does a bunch of book-keeping to maintain the state of the writer to allow for incremental writing. The fast pass works by determining whether there is enough space left in the buffer to write the current record, based on a comparison with the upper bound of the space required for that record. If it fits, then we write the record to the buffer directly without all of the state management. The downside is that this requires an extra API method, read_byte_record. It's necessary because our heuristic needs to be able to cheaply compute the number of fields and the total number of bytes in the record, which isn't available in generic iterator APIs (including ExactSizeIterator).
- Loading branch information
1 parent
f617f8f
commit b8175c4
Showing
2 changed files
with
219 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters