babel
babel copied to clipboard
Improve extract performance via ignoring directory early during os.walk
Currently, the extraction code will do an os.walk to perform a deep file search. However, this file exploration could be very slow when there were directories that were deep and contain many files. Even if you have specified some directories to be ignored in the mapping file, the os.walk would explore these directories.
The PR improves the extract process performance via making sure to skip exploring those ignore directory early during os.walk.
Real-life scenario I have experience
When you are working with front-end, typically you would have a node_modules directory in your codebase which contains source codes of all 3rd party lib (similar to Python's /site-packages/), and this directory typically is very large.
Codecov Report
Merging #694 into master will decrease coverage by
0.03%. The diff coverage is77.77%.
@@ Coverage Diff @@
## master #694 +/- ##
==========================================
- Coverage 90.97% 90.94% -0.04%
==========================================
Files 24 24
Lines 4176 4184 +8
==========================================
+ Hits 3799 3805 +6
- Misses 377 379 +2
| Impacted Files | Coverage Δ | |
|---|---|---|
| babel/messages/extract.py | 94.38% <77.77%> (-0.56%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 0cfa69e...6ada6ee. Read the comment docs.
Ping @akx
Hi @stkao05 – #832 landed today, so this would need to be rebased :)