Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fread() instead of read() + Add GNUC format validator (#37)
This commit attempts to reflect also part of the work from previous messy commit: 1. Add GNUC format validator for RDB_log() and RDB_reportError() 2. fread() instead of read() to improve performance. >> 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.
- Loading branch information