[flang-commits] [PATCH] D118649: [flang] runtime perf: larger I/O buffer growth increments

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Jan 31 13:33:30 PST 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

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.


https://reviews.llvm.org/D118649

Files:
  flang/runtime/buffer.h


Index: flang/runtime/buffer.h
===================================================================
--- flang/runtime/buffer.h
+++ flang/runtime/buffer.h
@@ -135,7 +135,7 @@
     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_)};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118649.404711.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220131/78e10112/attachment.bin>


More information about the flang-commits mailing list