Skip to content
Discussion options

You must be logged in to vote

IIRC, I tried using memchr because of a similar inclination when I wrote the parser. I can't remember the results, but IIRC, it improved some cases (CSV data with a lot of large fields) but regressed other cases (CSV data with short fields). I perceive the latter as more common. That is, while some CSV data might have a column or two with longer fields, I think most fields are very short (e.g., numbers). In this case, the overhead of starting and stopping memchr on each field ends up being slower.

That's generally consistent with my understanding of memchr. That is, haystack.iter().position(|&b| b == needle) is likely to be a hair faster one very tiny haystacks because there is less start…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Yomguithereal
Comment options

@Yomguithereal
Comment options

@BurntSushi
Comment options

@Yomguithereal
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants