Files
RustPython/benches/microbenchmarks/sorted.py
Jack O'Connor 763d5d48b5 Add sorted.py to microbenchmarks (#6086)
* Add microbenchmark for `sorted`

I chose 5 * Iterations to try better show that RustPython
sort implementation scales noticeably worse CPython's
with respect to the number of elements.

* Mention how to run a specific benchmark

* Update python version in bench README

3.13 better reflects the current state of the project vs 3.7.
2025-08-28 09:58:20 +09:00

10 lines
183 B
Python

from random import random, seed
seed(0)
unsorted_list = [random() for _ in range(5 * ITERATIONS)]
# ---
# Setup code only runs once so do not modify in-place
sorted(unsorted_list)