[flang-commits] [flang] 702c0cf - [flang] runtime perf: larger I/O buffer growth increments
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Jan 31 14:53:24 PST 2022
Author: Peter Klausler
Date: 2022-01-31T14:53:15-08:00
New Revision: 702c0cfa07597af150b0556c97ce0431a7d1de59
URL: https://github.com/llvm/llvm-project/commit/702c0cfa07597af150b0556c97ce0431a7d1de59
DIFF: https://github.com/llvm/llvm-project/commit/702c0cfa07597af150b0556c97ce0431a7d1de59.diff
LOG: [flang] runtime perf: larger I/O buffer growth increments
When reallocating an I/O buffer to accommodate a large record,
ensure that the amount of growth is at least as large as the
minimum initial record size (64KiB). The previous policy was
causing input buffer reallocation for each byte after the minimum
buffer size when scanning input data for record termination
newlines.
Differential Revision: https://reviews.llvm.org/D118649
Added:
Modified:
flang/runtime/buffer.h
Removed:
################################################################################
diff --git a/flang/runtime/buffer.h b/flang/runtime/buffer.h
index eec28419a58f5..0bc3e0a37ded8 100644
--- a/flang/runtime/buffer.h
+++ b/flang/runtime/buffer.h
@@ -135,7 +135,7 @@ template <typename STORE, std::size_t minBuffer = 65536> class FileFrame {
if (bytes > size_) {
char *old{buffer_};
auto oldSize{size_};
- size_ = std::max<std::int64_t>(bytes, minBuffer);
+ size_ = std::max<std::int64_t>(bytes, size_ + minBuffer);
buffer_ =
reinterpret_cast<char *>(AllocateMemoryOrCrash(terminator, size_));
auto chunk{std::min<std::int64_t>(length_, oldSize - start_)};
More information about the flang-commits
mailing list