And I tried removing co_firstfileno in optimize branch.
https://github.com/larryhastings/co_annotations/pull/9

Microbenchmarks.
(https://gist.github.com/methane/abb509e5f781cc4a103cc450e1e7925d)

```
# co_annotations branch (63b415c3)
$ ./python ~/ann_test.py 3
code size: 229679 bytes
memory: 209077 bytes
unmarshal: avg: 639.631ms +/-0.254ms
exec: avg: 95.979ms +/-0.033ms

$ ./python ~/ann_test_method.py 3
code size: 245729 bytes
memory: 339109 bytes
unmarshal: avg: 672.997ms +/-9.039ms
exec: avg: 259.286ms +/-4.841ms

# optimize branch (fbf0ad725f)
$ ./python ~/ann_test.py 3
code size: 113082 bytes
memory: 209077 bytes
unmarshal: avg: 318.437ms +/-0.171ms
exec: avg: 100.187ms +/-0.141ms

$ ./python ~/ann_test_method.py 3
code size: 129134 bytes
memory: 284565 bytes
unmarshal: avg: 357.157ms +/-0.971ms
exec: avg: 262.066ms +/-5.258ms
```

By the way, this microbenchmark uses 3 arguments and 1 return value.
annotation value is chosen from 3 (e.g. ["int", "str", "foo.bar.baz"]).
So there are 3*3*3*3=81 signatures, not only 27.

Anyway, 81/1000 may not be realistic.
When I changed ann_test to chose annotation value from 5 (e.g. 625/1000):

```
# co_annotations
$ ./python ~/ann_test.py 3
code size: 236106 bytes
memory: 208261 bytes
unmarshal: avg: 653.788ms +/-1.257ms
exec: avg: 95.783ms +/-0.169ms

# optimize
$ ./python ~/ann_test.py 3
code size: 162097 bytes
memory: 208261 bytes
unmarshal: avg: 458.959ms +/-0.163ms
exec: avg: 98.327ms +/-0.065ms
```


--
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/FN26LGNAOMRPRVR2THUBBBUFZWPEOWSB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to