Comments (2)
Hi Sam, thanks for sharing the example. Indeed, it's quite surprising to see such a long run time for such a simple file.
The raw
command is definitely the slowest, and that's because it does not use the ast
module to parse the file, instead it uses tokenize
. The latter is written in pure Python instead of C, so that's already a slowing factor. Moreover, when parsing the AST we can use efficient techniques like the visitor pattern, which are not available with the tokenize
module.
However, the superlinear complexity is definitely in Radon's code. It performs some complicated operations to count logical lines, and I suspect that's where the slowest code is. I think your example highlights one of the inefficiencies particularly well.
The next step would be to profile the code. A flamegraph should already give some very useful hints. I'll try to investigate this when I've got time.
from radon.
Thanks for the info, that's really helpful!
from radon.
Related Issues (20)
- Installing radon breaks flake8 HOT 8
- Support of pyproject.toml file HOT 1
- Is Randon able to run into Java files? HOT 2
- [feature] Add support for pre-commit HOT 5
- Python 3.10: match-case syntax not yet supported by radon? HOT 1
- summary not shown when using --json flag HOT 3
- 5.1.0: sphinx warnings HOT 2
- Misspelled 'clasification' in markdown exports HOT 1
- Documentation link outdated HOT 2
- wrong complexity for linear function HOT 1
- New release to drop future package HOT 7
- 5.1.0 - wrong import HOT 2
- Support mi/hal in flake8 plugin
- Radon crashes on unrelated config option in pyproject.toml HOT 3
- Add line numbers to Halstead results
- RFE: is it possible to start making github releases?🤔
- Radon can't run when use pytest log fornat: `$()d` HOT 1
- Radon might detect Wget in Python as errors HOT 1
- Incorrect lloc count HOT 2
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 radon.