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

Improve: Reduce import time #719

Merged
merged 9 commits into from
Oct 8, 2022
Merged

Improve: Reduce import time #719

merged 9 commits into from
Oct 8, 2022

Conversation

wannaphong
Copy link
Member

@wannaphong wannaphong commented Oct 8, 2022

Improve: reduce import time

@wannaphong
Copy link
Member Author

PyThaiNLP v3.1.0

python -X importtime -c "from pythainlp.tokenize import word_tokenize" 2> wordcut-3.1.log

ภาพ

This patch

python -X importtime -c "from pythainlp.tokenize import word_tokenize" 2> wordcut-import2.log

ภาพ

@wannaphong wannaphong added this to the 3.2 milestone Oct 8, 2022
@wannaphong
Copy link
Member Author

@coveralls
Copy link

coveralls commented Oct 8, 2022

Coverage Status

Coverage increased (+0.05%) to 93.764% when pulling f3bc46e on improve-1 into 7975bc8 on dev.

@wannaphong wannaphong changed the title Improve reduce import time Improve: Reduce import time Oct 8, 2022
@wannaphong wannaphong mentioned this pull request Oct 8, 2022
4 tasks
@wannaphong wannaphong closed this Oct 8, 2022
@wannaphong wannaphong reopened this Oct 8, 2022
@BLKSerene
Copy link
Contributor

BLKSerene commented Oct 8, 2022

Well, delaying imports of optional dependencies of PyThaiNLP, like sentencepiece, pycrfsuite, and gensim, is fine (except Requests, which is a required dependency), but I think that delaying import statements of Python standard libraries, such as random, tarfile, and shutil, would make future maintenance work trickier, and would not impact much on the import speed?

@wannaphong
Copy link
Member Author

Well, delaying imports of optional dependencies of PyThaiNLP, like sentencepiece, pycrfsuite, and gensim, is fine (except Requests, which is a required dependency), but I think that delaying import statements of Python standard libraries, such as random, tarfile, and shutil, would make future maintenance work trickier, and would not impact much on the import speed?

I think it isn't impact the future maintenance because It uses only few function and use few time (train Perceptron model, download file, unzip file).

@sonarcloud
Copy link

sonarcloud bot commented Oct 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wannaphong wannaphong merged commit e21abbf into dev Oct 8, 2022
@wannaphong wannaphong deleted the improve-1 branch October 11, 2022 05:06
@wannaphong wannaphong restored the improve-1 branch October 30, 2022 17:13
wannaphong added a commit that referenced this pull request Oct 30, 2022
Add Reduce import time #719 to PyThaiNLP 3.1.1
wannaphong added a commit that referenced this pull request Oct 30, 2022
PyThaiNLP v3.1.1 is the releases updates of PyThaiNLP v3.1.0.

-  Add Reduce import time #719 to PyThaiNLP 3.1.1 #753
-  Doc: Lst20 deprecation warning for 3.1.1 (#749) #752
@wannaphong wannaphong mentioned this pull request Oct 30, 2022
@wannaphong wannaphong deleted the improve-1 branch October 30, 2022 18:25
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.

None yet

3 participants