Skip to content

Instantly share code, notes, and snippets.

@mattip
Last active May 18, 2021 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattip/9cf9b8916edc3cc12b90e0c3df785b7d to your computer and use it in GitHub Desktop.
Save mattip/9cf9b8916edc3cc12b90e0c3df785b7d to your computer and use it in GitHub Desktop.
Comparison of jit summary before and after py3.7-cpyext-unroll-a-bit 1f4c96de61ee
BEFORE AFTER
[4e2f663bd9fe8] {jit-summary [4e2d5889878b8] {jit-summary
Tracing: 86 0.100334 Tracing: 78 0.113238
Backend: 74 0.031218 Backend: 66 0.032329
TOTAL: 1.515222 TOTAL: 1.509000
ops: 124400 ops: 123038
heapcached ops: 78660 heapcached ops: 79768
recorded ops: 39196 recorded ops: 40168
calls: 6160 calls: 5844
guards: 9656 guards: 10059
opt ops: 12887 opt ops: 13033
opt guards: 3289 opt guards: 3415
opt guards shared: 1905 opt guards shared: 1942
forcings: 0 forcings: 0
abort: trace too long: 0 abort: trace too long: 0
abort: compiling: 0 abort: compiling: 0
abort: vable escape: 10 abort: vable escape: 10
abort: bad loop: 0 abort: bad loop: 0
abort: force quasi-immut: 2 abort: force quasi-immut: 2
nvirtuals: 15798 nvirtuals: 22346
nvholes: 9318 nvholes: 13795
nvreused: 5274 nvreused: 7065
vecopt tried: 0 vecopt tried: 0
vecopt success: 0 vecopt success: 0
Total # of loops: 38 Total # of loops: 33
Total # of bridges: 37 Total # of bridges: 34
Freed # of loops: 6 Freed # of loops: 3
Freed # of bridges: 4 Freed # of bridges: 2
[4e2f663be4128] jit-summary} [4e2d588991f70] jit-summary}
import numpy as np
import time
try:
import __pypy__
except ImportError:
__pypy__ = None
if __pypy__:
__pypy__.debug_start('jit-log-opt-funny')
__pypy__.debug_print('done importing')
__pypy__.debug_stop('jit-log-opt-funny')
def main():
a = np.array([], dtype=float, ndmin=3)
for i in range(10_000):
b = np.median(a)
if not np.isnan(b):
import pdb;pdb.set_trace()
if __name__ == '__main__':
t1 = time.time()
main()
t2 = time.time()
print('time', t2 - t1)
# Run with PYPYLOG=jit-log-opt,jit-summary,jit-backend-count:out pypy3 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment