mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
**Context:** This is an experimental performance optimization that we're hoping to use for our internal linter at Instagram. I added some documentation, but it's unsupported, and isn't very user-friendly. This adds `ExperimentalReentrantCodegenProvider`, which tracks the codegen's internal state (indentation level, character offsets, encoding, etc.) and for each statement, it stores a `CodegenPartial` object. The `CodegenPartial` object has enough information about the previous codegen pass to run the codegen on part of a tree and patch the result back into the original module's string. In cases where we need to generate a bunch of small independent patches for the same file (and we can't just generate a new tree with each patch applied), this *should* be a faster alternative. I don't have any performance numbers because I still need to test this end-to-end with our internal codebase, but I'd be shocked if it was slower than what we're doing. This could theoretically live outside of LibCST, but it depends on a whole bunch of LibCST internals, so there's some value in making sure that this is in sync with the rest of LibCST. |
||
|---|---|---|
| .. | ||
| _static | ||
| _templates | ||
| best_practices.rst | ||
| conf.py | ||
| experimental.rst | ||
| index.rst | ||
| matchers.rst | ||
| matchers_tutorial.ipynb | ||
| metadata.rst | ||
| metadata_tutorial.ipynb | ||
| motivation.rst | ||
| nodes.rst | ||
| parser.rst | ||
| scope_tutorial.ipynb | ||
| tutorial.ipynb | ||
| visitors.rst | ||
| why_libcst.rst | ||