diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-11-21 05:05:25 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-11-21 05:10:45 +0100 |
| commit | a1a44309756c1f69ab66fd6c165480f93ccb0d5d (patch) | |
| tree | 3881f4e50297657d268df318e17579b00c097b58 /makefile.patch | |
| parent | d3866958c7685cd6e4e8f5960cbaed59794e3894 (diff) | |
Use 'foo.__class__ is Bar' instead of 'isinstance(foo, Bar)'
This is 30%-60% faster for both the matching and non-matching case, as
measured with timeit on Python 2.7 and 3.6, and saves at least a few
percent of total parsing time (and probably some evaluation time too).
isinstance(foo, tuple) is particularly slow.
Symbol and Choice instances are always created by us, so potential
subclassing shouldn't be a problem.
Diffstat (limited to 'makefile.patch')
0 files changed, 0 insertions, 0 deletions
