Repository navigation
scrub() in C++, without regular expressions - #64
Merged
Merged
Conversation
This reverts commit 793112d.
AlbanSagouis
marked this pull request as ready for review
November 19, 2026 16:18
The scrub() half of bc796b8. check_encoding() in R/zzz.R stops on strings marked "bytes" and on latin1 strings with a byte that Windows-1252 leaves undefined. The C++ "bytes" check in src/scrub.cpp can no longer fire and is removed. The format path does not call check_encoding() yet.
…dling of latin1 junk bytes On this branch the format path does not call check_encoding(), so the test pinned what R does with the byte 0x81: an error on macOS, NA with a warning on Windows. #65 replaces it with parzer's own error, the same on every platform.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the input cleaning
scrub()from twogsub()calls to one regex-free C++ loop (src/scrub.cpp).scrub()in R becomespz_scrub(enc2utf8(num_to_chr(x))). Its output was pinned beforehand bytests/testthat/test-scrub.R(1085 strings from the tests plus edge cases), and that file passes unchanged. Strings marked "bytes" now give an error, as invalid UTF-8 already did.Speedup of
parse_lat()measured on CI in this PR (old time / new time, same run): macOS 1.81x, Ubuntu 1.56x to 1.72x, Windows 1.31x.scrub()alone is 6.7 times faster on macOS.