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

Implement Python Import Caching #2905

Merged
merged 5 commits into from
Feb 23, 2024
Merged

Implement Python Import Caching #2905

merged 5 commits into from
Feb 23, 2024

Conversation

mxwli
Copy link
Contributor

@mxwli mxwli commented Feb 16, 2024

py::module::import("module").attr("attribute");

becomes

kuzu::pycache::import_cache->module.attribute();

Now that modules are shared, it's required to acquire the Global Interpreter Lock before accessing modules.

Technically, it's possible to skip acquiring this lock if we know the module is already cached, but that isn't implemented here.

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: Patch coverage is 97.10145% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.49%. Comparing base (93fc6e2) to head (9e9e381).
Report is 2 commits behind head on master.

Files Patch % Lines
...api/src_cpp/include/cached_import/py_cached_item.h 50.00% 1 Missing ⚠️
.../src_cpp/include/cached_import/py_cached_modules.h 95.65% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2905   +/-   ##
=======================================
  Coverage   93.48%   93.49%           
=======================================
  Files        1116     1121    +5     
  Lines       42717    42759   +42     
=======================================
+ Hits        39936    39978   +42     
  Misses       2781     2781           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mxwli mxwli force-pushed the python-import-cache branch 3 times, most recently from 27f97a5 to c20ce98 Compare February 22, 2024 18:22
@mxwli mxwli marked this pull request as ready for review February 22, 2024 18:41
@mxwli mxwli merged commit c4c005b into master Feb 23, 2024
15 checks passed
@mxwli mxwli deleted the python-import-cache branch February 23, 2024 17:49
Copy link
Contributor

@Riolku Riolku left a comment

Choose a reason for hiding this comment

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

Not a comprehensive list, but these are some copies I think, and they need to hold the GIL,.

@andyfengHKU andyfengHKU mentioned this pull request Apr 15, 2024
32 tasks
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.

3 participants