[PATCH] D47170: [fuchsia] Add line buffering in RawWrite

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 17:44:44 PDT 2018


mcgrathr added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc:415
+    if (cur >= sizeof(line) || *buffer == '\n') {
+      __sanitizer_log_write(line, cur);
+      cur = 0;
----------------
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).



Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D47170





More information about the llvm-commits mailing list