Introduce buffered I/O and replace getc with buffered read#647
Closed
pawosm-arm wants to merge 2 commits into
Closed
Introduce buffered I/O and replace getc with buffered read#647pawosm-arm wants to merge 2 commits into
pawosm-arm wants to merge 2 commits into
Conversation
Collaborator
Author
|
Anticipating your questions, setvbuf() is a very standard stdio.h function and you can find its documentation in Linux man pages and Visual Studio reference pages as well. |
This commit introduces 32k buffer for file I/O operations and 32k buffer for fgetc() replacemnt routines. Some performance gain is observed and 'perf' trace does not show getc operations at all, shifting the burden to actual I/O system routines. In order to improve performance of these, 32k buffer is attached to every opened file by calling setvbuf() function. Due to suspicious way of passing pointers around in flang runtime, all of the I/O buffers had to be allocated statically. In order to prevent memory bloat, only limited number of simultaneously opened files will be buffered, file descriptor ID is used for buffer selection which is a thread-safe solution. Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
… when really needed) This is supplementary to the commit which introduces buffered I/O. Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Collaborator
|
We agreed to close this one at the last call. |
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.
This commit introduces 32k buffer for file I/O operations
and 32k buffer for fgetc() replacemnt routines.
This is follow-up of my work presented in pull request #642.
Some performance gain is observed and 'perf' trace does not
show getc operations at all, shifting the burden to actual
I/O system routines. In order to improve performance of these,
32k buffer is attached to every opened file by calling
setvbuf() function.
Due to suspicious way of passing pointers around in flang runtime,
all of the I/O buffers had to be allocated statically. In order to
prevent memory bloat, only limited number of simultaneously opened
files will be buffered, file descriptor ID is used for buffer
selection which is a thread-safe solution.
The test case I was using is following:
my_file.txt.gz
Compiled with gfortran it gives much better timing results that when compiled with flang. My patch improves the timing of flang compiled program.