oracle / graalpython

GraalPy – A high-performance embeddable Python 3 runtime for Java
https://www.graalvm.org/python/
Other
1.24k stars 108 forks source link

Repeated compiled-code invalidation possibly related to `list.clear()` #216

Closed smarr closed 3 years ago

smarr commented 3 years ago

To reproduce, grab https://github.com/smarr/are-we-fast-yet/tree/932b44ec0a5f004454720a2069413cb9ada76bcb/benchmarks/Python

and run graalpython harness.py harness.py Havlak 100 1500

The clear operations here seem to cause (eventually, probably not directly) code invalidation, which means it keeps recompiling:

https://github.com/smarr/are-we-fast-yet/blob/932b44ec0a5f004454720a2069413cb9ada76bcb/benchmarks/Python/havlak.py#L368-L369

Replacing them with a simple new list leads to code that's 10x as fast.

msimacek commented 3 years ago

Thank you for the report. I'll take a look shortly.