diff options
| author | Daniel Harding <dharding@living180.net> | 2021-05-19 13:31:19 +0300 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2022-08-08 10:52:33 +0200 |
| commit | a3e19f1cbdf929eb45dc0e22d116b466d7b985a1 (patch) | |
| tree | 5cd51c3fedd668fd2bf610a5fdafa4ad6c7377f3 /sqlparse/exceptions.py | |
| parent | 4073b569428036259a093dcbfe0f67ac3ef3a1e0 (diff) | |
| download | sqlparse-a3e19f1cbdf929eb45dc0e22d116b466d7b985a1.tar.gz | |
Don't make slice copies in TokenList._token_matching().
Since we are working with indexes anyway, don't bother calling
enumerate() with a slice from self.tokens (which requires copying
memory). Instead, just generate the indexes using range() and use
normal indexing to access the desired tokens.
The old behavior resulted in quadratic runtime with respect to the
number of tokens, which significantly impacted performance for
statements with very large numbers of tokens.
With the new behavior, the runtime is now linear with respect to the
number of tokens.
Diffstat (limited to 'sqlparse/exceptions.py')
0 files changed, 0 insertions, 0 deletions
