fread() instead of read() + Add GNUC format validator #37
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 attempts to reflect also part of the work from previous messy commit:
Add GNUC format validator for RDB_log() and RDB_reportError()**
In case of GNUC compiplation add attribute((format(printf, X, Y)))
To verify during compilation correctness of the provided FORMAT
versus variadic arguments that follows.
fread() instead of read() to improve performance**
Following a preliminary benchmark that involved reading from a
file-descriptor (fd) I have found out that assisting openfd()
outperform around ~50% better than using lower level read().
This is because when using bare read(), it makes multiple
system-calls to read a small amount of data whereas fread()
attempts to read a big chunk of data to user-space, even if
requested a small amount. I also tested using bare read() with
a buffer that i managed inside readerFileDesc.c and it reached
Similar results to fread().
Note, the benchmark relied on librdb library that is integrated
into another utility (rl_rdbloader), the adjustment is relatively
self-contained and provides a reliable indication of its
effectiveness.