-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
Cache xonshrc and imports #5276
Comments
Basically xonsh has codecache. PR with improvements is welcome! |
@anki-code Is there an existing way to turn on the code caching for .xsh files? Or are you suggesting I create a Pull Request that updates XonshImportHook to utilize codecache? |
Xonsh already cashes xsh files and parts of code (i.e. |
xonfig
+------------------+-----------------+
| xonsh | 0.9.24 |
| Python | 3.8.5 |
| PLY | 3.11 |
| have readline | True |
| prompt toolkit | 3.0.8 |
| shell type | prompt_toolkit |
| pygments | 2.7.2 |
| on posix | False |
| on linux | False |
| on darwin | False |
| on windows | True |
| on cygwin | False |
| on msys2 | False |
| is superuser | False |
| default encoding | utf-8 |
| xonsh encoding | utf-8 |
| encoding errors | surrogateescape |
| on jupyter | True |
| jupyter kernel | None |
+------------------+-----------------+
Problem
In my .xonshrc I'm importing a .xsh file that is 700 lines long. Its taking about 20 seconds which seems excessive.
I profiled and its spending all the time compiling the code.
Is this expected?
I guess its pretty slow to do all the tokenizing, parsing, ... in python, but I was hoping it could at least be cached so my terminal is fast to startup the next time.
I asked ChatGPT and it gave me this code which is working well. I put it at the beginning of my .xonshrc. So maybe something like this could be done automatically?
The text was updated successfully, but these errors were encountered: