This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Anthony Sottile
Recipients Anthony Sottile
Date 2021-01-24.08:34:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611477254.42.0.0381684920705.issue43014@roundup.psfhosted.org>
In-reply-to
Content
I did some profiling (attached a few files here with svgs) of running this script:

```python
import io
import tokenize

# picked as the second longest file in cpython
with open('Lib/test/test_socket.py', 'rb') as f:
    bio = io.BytesIO(f.read())


def main():
    for _ in range(10):
        bio.seek(0)
        for _ in tokenize.tokenize(bio.readline):
            pass

if __name__ == '__main__':
    exit(main())
```


the first profile is before the optimization, the second is after the optimization

The optimization takes the execution from ~6300ms to ~4500ms on my machine (representing a 28% - 39% improvement depending on how you calculate it)

(I'll attach the pstats and svgs after creation, seems I can only attach one file at once)
History
Date User Action Args
2021-01-24 08:34:14Anthony Sottilesetrecipients: + Anthony Sottile
2021-01-24 08:34:14Anthony Sottilesetmessageid: <1611477254.42.0.0381684920705.issue43014@roundup.psfhosted.org>
2021-01-24 08:34:14Anthony Sottilelinkissue43014 messages
2021-01-24 08:34:14Anthony Sottilecreate