Comments (4)
I added some logging:
0_check_with_pyright_start: "01:34:10.683"
1_pyright_run_start: "01:34:10.684"
2_pyright_run_end: "01:34:38.457"
Logging is added in
Python-Type-Challenges/views/challenge.py
Lines 147 to 154 in d900b70
It's clear that pyright takes 28s to finish!
Given subsequent runs take significantly less time, I think this is due to pyright needs to generate indexes and cache the first time it runs.
Given we don't really need to analyze third-party libraries installed in the virtualenv (which pyright does by default), I'll see how can we disable this behavior.
from python-type-challenges.
Further adding --stats
to pyright gives and reran
Overall takes ~27s
1_pyright_run_start: "02:18:28.676"
2_pyright_run_end: "02:18:55.150"
Detailed:
added 1 package, and audited 2 packages in 14s
found 0 vulnerabilities
Loading pyproject.toml file at /app/pyproject.toml
Found 1 source file
pyright 1.1.334
/tmp/tmpn3_n1gxk.py
/tmp/tmpn3_n1gxk.py:13:8 - error: Expected 1 positional argument (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations
Completed in 1.903sec
Analysis stats
Total files parsed and bound: 18
Total files checked: 1
Timing stats
Find Source Files: 0sec
Read Source Files: 0.08sec
Tokenize: 0.14sec
Parse: 0.32sec
Resolve Imports: 0.18sec
Bind: 0.58sec
Check: 0.06sec
Detect Cycles: 0sec
WARNING: there is a new pyright version available (v1.1.334 -> v1.1.337).
Please install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`
So out of 27s, installing node packages takes 14s, analyzing takes 2s. It's still unclear where the other 10s is spent on, but at least we know installing node packages is the biggest contributor to slow run
from python-type-challenges.
Reading https://github.com/microsoft/pyright/blob/main/docs/configuration.md, I can't find any option to pre-install node_modules. It mentions ignoring files when analyzing, but since we only checked one file (see above), I don't think this will help.
Given that, seems the only way is to simply pre-run pyright upon server start, to warm things up.
from python-type-challenges.
Tested on the debug branch and it worked well.
from python-type-challenges.
Related Issues (20)
- Errors in running "Challenge - concatenate" HOT 2
- Add `from typing import *` to boilerplate HOT 2
- Add newline in `typealias` challenge HOT 1
- Consider adding a hint message with links for each question HOT 5
- Allow custom challenge order HOT 4
- Record and show passed challenges
- The ellipsis in the function parameters of challenge intermediate/literalstring causes challenge failed HOT 3
- extreme-concatenate not working? (maybe outdated pyright) HOT 3
- much simpler solution to `extreme-self-casting` HOT 4
- [Bug] Pass challenges with `raise` HOT 6
- Too easy to pass `extreme-variance` HOT 5
- Enable UTF-8 mode for python (PEP 686) HOT 3
- [CI] Fail when pre-commit run
- [Web] 500 Internal Server Error HOT 3
- On mobile devices, click elsewhere on the screen should fold the challenge list
- [Web] Use HTMX to random page. HOT 3
- [Formatter] Replace `black` HOT 1
- [Bug] Old CodeMirrors are not remove HOT 1
- [Docs] Add random challenge entrance to README
- Return type for extreme concatenate HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-type-challenges.