This change causes RawWrite to buffer upto 128 bytes or until a line is reached. This helps group calls into more readable lines.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc | ||
---|---|---|
415 | Ideally you'd buffer multiple short lines when they're all in the same call and do a single __sanitizer_log_write call. |
Modified to group multiple lines into a single flush but still flush at least once if a newline is found.
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc | ||
---|---|---|
419 | if lastNewline was null now it's line and so this writes a count of 0. | |
428 | This seems like an odd way to describe it. The behavior is just "Flush all complete lines before returning". |
Ideally you'd buffer multiple short lines when they're all in the same call and do a single __sanitizer_log_write call.
To really flush only when necessary you'd compact the buffer if there's a partial line left after a flush or do some sort of ring-buffer arrangement.
You can do a bit better than the by-char loop using internal_strchr (which might get optimized though it isn't now).