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

Improving class loading efficiency and considering dynamic type list #919

Merged
merged 17 commits into from
Apr 5, 2023

Conversation

J007X
Copy link
Collaborator

@J007X J007X commented Feb 1, 2023

This PR fixes #908.

This PR addresses class loading efficiency issue by adding lru_cache to get_class() method, and also resolved the concern raised in #765 about dynamic type list indata_store, so in the "is_subclass" method a special non-cached version of get_class (get_class_nc) is called instead

Possible influences of this PR.

By using a special non-cached version of get_class (get_class_nc) in "is_subclass" might cause a slight performance impact of a few percentage (to ensure correctness), in the future there might be improved ways to make the method using some kind of caching mechanism safely.

Test Conducted

testPOSTaggingNER() method in "data_pack_profiling_test" for checking performance changes (performance improved from non-lru cached versions of "get_class" in utils.py)

…n new code after underline changes related to data pack. After discussed with Hector using standard LRU_Cache instead of custom cache.
… created an non-cached version of get_class (get_class_nc) and used in get_class to avoid dynamic list issue as mentioned in comments of asyml#765 as pointed out my Hector.
@hunterhector
Copy link
Member

hunterhector commented Feb 1, 2023

please fix the "This PR fixes" line again. Please learn how to use this syntax

Copy link
Member

@hunterhector hunterhector left a comment

Choose a reason for hiding this comment

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

Please fix the conflicts and fix the doc error

@J007X
Copy link
Collaborator Author

J007X commented Feb 2, 2023

please fix the "This PR fixes" line again. Please learn how to use this syntax

Sorry forgot to remove the "[ ]" in the template. The format is now fixed.

@J007X J007X self-assigned this Feb 16, 2023
J007X and others added 3 commits March 22, 2023 15:52
…at have optional list as parameter -- change to cache lower level result from "locate" method called in this method, and also provide a non-cached version (same as before) for resolving asyml#765.
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #919 (e2939a1) into master (ae14581) will increase coverage by 0.00%.
The diff coverage is 91.66%.

@@           Coverage Diff           @@
##           master     #919   +/-   ##
=======================================
  Coverage   81.05%   81.06%           
=======================================
  Files         256      256           
  Lines       19851    19858    +7     
=======================================
+ Hits        16091    16097    +6     
- Misses       3760     3761    +1     
Impacted Files Coverage Δ
forte/utils/utils.py 79.45% <90.90%> (+0.31%) ⬆️
forte/data/data_store.py 93.31% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

forte/utils/utils.py Outdated Show resolved Hide resolved
forte/utils/utils.py Outdated Show resolved Hide resolved
forte/utils/utils.py Outdated Show resolved Hide resolved
…e-factoring into one method with "cached_lookup" optional flag -- by default this is true but in _get_sub_class this flag needs to set to "false" based on comments in asyml#765 (for dynamic class loading scenario).
@hunterhector hunterhector merged commit 35c1ced into asyml:master Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants