Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HWS: Improvements to binary file handling #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nv-aefimov
Copy link

HWS: Open the binary file in read-only mode

We do not write to this file, so there is no reason to open it
in r+ (read + update) mode.

Signed-off-by: Alexander Efimov [email protected]


HWS: Keep the binary file open between each read

This has 2 advantages:

  1. Performance: fewer syscalls due to no longer repeatedly closing and
    reopening the same file
  2. Exception safety, guaranteeing that this file will be closed at the
    end of the with clause

Signed-off-by: Alexander Efimov [email protected]

This has 2 advantages:
1) Performance: fewer syscalls due to no longer repeatedly closing and
 reopening the same file
2) Exception safety, guaranteeing that this file will be closed at the
 end of the `with` clause

Signed-off-by: Alexander Efimov <[email protected]>
We do not write to this file, so there is no reason to open it
in `r+` (read + update) mode.

Signed-off-by: Alexander Efimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant