Conversation
d2ef07d to
90ac95d
Compare
seisman
commented
May 21, 2024
07b06ac to
b42b758
Compare
833efb4 to
9907af7
Compare
9907af7 to
f55d5d4
Compare
weiji14
reviewed
Jul 29, 2024
| func.restype = ctypes.c_float | ||
| major, minor, patch = ctypes.c_uint(0), ctypes.c_uint(0), ctypes.c_uint(0) | ||
| func(None, major, minor, patch) | ||
| return f"{major.value}.{minor.value}.{patch.value}" |
Member
There was a problem hiding this comment.
Thoughts on returning an instance of packaging.version.Version instead of a str?
Member
Author
There was a problem hiding this comment.
but __gmt_version__ should be a string.
Member
There was a problem hiding this comment.
Mm ok, could also do str(get_gmt_version()), but ok to just return a string itself. Just thought it could simplify some of the test code.
weiji14
approved these changes
Jul 29, 2024
Member
weiji14
left a comment
There was a problem hiding this comment.
Just two tiny suggestions. Having the code spread across clib/__init__.py, clib/loading.py and clib/session.py is a little confusing, but seems to make sense after going through it.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
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.
Description of proposed changes
In the
Session.__enter__method, we check if the GMT library version is equal to or newer than the required version. This special method is called when entering the context manager, i.e.,with Session() as lib. So it means we're repeatedly checking the GMT version.This PR refactors the clib codes to check the GMT version only once when loading the GMT library.
I expect to see some performance improvements
but the benchmarks say no. So I believe the performance improvement should be very little.https://codspeed.io/GenericMappingTools/pygmt/branches/clib/check-version show an average 2% performance improvement.