-
Notifications
You must be signed in to change notification settings - Fork 106
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
Takes 0.8 seconds to import tree_sitter #167
Comments
Something's off in your system, same code for me:
Are you on Linux? Can you use perf to profile it and upolad the data here? |
There’s also $ python -Ximporttime -c 'import tree_sitter'
import time: self [us] | cumulative | imported package
[...]
import time: 613 | 613 | json.encoder
import time: 347 | 2441 | json
import time: 2406 | 129771 | distutils
import time: 513 | 130284 | distutils.ccompiler
import time: 444 | 444 | shlex
import time: 176 | 176 | distutils.py39compat
import time: 168 | 168 | distutils._functools
import time: 927 | 1269 | distutils.sysconfig
import time: 168 | 168 | distutils._macos_compat
import time: 361 | 2240 | distutils.unixccompiler
import time: 653 | 653 | tree_sitter.binding
import time: 871 | 140812 | tree_sitter Unrelated to this issue, I think it’s probably worthwhile to move the |
Nice! I didn't know about importtime. I'm running this on linux (SLES12). I did some further debugging. It turns out that I had my PYTHONPATH set to point directly to the site packages (which are on NFS), however the tree_sitter module was only installed in my venv (also on NFS). That was the only module that was in my local venv and not in site packages which is why I did not see a similar time penalty for any of the other modules I'm using. Python was still able to find tree_sitter, but I guess using PYTHONPATH caused a huge time penalty. Here is the import time with the bad PYTHONPATH:
Here it is without PYTHONPATH being set:
|
I'm seeing exceptionally long load time on importing the tree_sitter module. This is more than doubling the load time of my app. Is this expected?
output:
The text was updated successfully, but these errors were encountered: