Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@matusvalo
Copy link
Contributor

@matusvalo matusvalo commented Mar 16, 2024

Adds --cache argument to cython command. It is built on top of #6090 and should be merged after it.

I suppose additional tests are needed to this PR. I will try to add to this PR.

Tests added.

Related to #6070

@matusvalo matusvalo added this to the 3.1 milestone Mar 16, 2024
@matusvalo matusvalo force-pushed the cython_cache branch 2 times, most recently from 6e6abee to 5e32b6c Compare March 19, 2024 20:49
@matusvalo
Copy link
Contributor Author

Rebased from master containing refactor of Cache code. Now PR is clean and ready for review.

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would guess that it could be cleaner if the caching (not necessarily the Cache object creation) was done just around the call to run_pipeline(). Maybe add a wrapper function run_cached_pipeline?

@matusvalo
Copy link
Contributor Author

Maybe add a wrapper function run_cached_pipeline?

implemented.

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I had lost this from sight.

Comment on lines 1213 to 1216

if cache and fingerprint:
cached = cache.lookup_cache(c_file, fingerprint)
if cached:
if not quiet:
print("%sFound compiled %s in cache" % (progress, pyx_file))
cache.load_from_cache(c_file, cached)
return
if not quiet:
print("%sCythonizing %s" % (progress, Utils.decode_filename(pyx_file)))
Copy link
Contributor

@scoder scoder Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a change in behaviour. It now always prints "Cythonizing…", even if it skips it due to the cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I have fixed this by reverting the logic so we are calling lookup_cache() here again. For consistency, I am not calling here load_from_cache() here but continuing to shared compile logic where we load it from the cache.

We can consider whether we want to cache method lookup_cache() by using @cached_function...

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to merge if the changes I propose are ok with you.

@matusvalo
Copy link
Contributor Author

All comments implemented. When CI/CD is green I will merge the PR to the master.

@matusvalo matusvalo merged commit c88b0e3 into cython:master Dec 6, 2024
63 checks passed
@matusvalo matusvalo deleted the cython_cache branch December 6, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants