Skip to content

Instantly share code, notes, and snippets.

View mattip's full-sized avatar

Matti Picus mattip

  • Quansight Labs
View GitHub Profile
@mattip
mattip / gist:cda65382ba3667756c081245e277d890
Last active May 15, 2020 11:47
find branches that have only a few commits
$for b in `hg branches -a -T "{branch} "`; do declare -i root=`hg id -n -r roots\(branch\($b\)\)`; declare -i head=`hg id -n -r $b`; if [ $(( head - root )) -lt 3 ]; then echo "$b $(( head - root )) $head - $root"; fi; done |less
cpyext-multiple-inheritance 1 99413 - 99412
experiment-simpler_rstr_getslice 1 98947 - 98946
chameleon 0 98427 - 98427
py3.7-tracemalloc 0 98260 - 98260
issue3111-no-lock-for-main 0 98244 - 98244
dynamic-jitcodes 0 97611 - 97611
codec_errorhandler 1 97395 - 97394
ann-systemexit 1 95875 - 95874
unicode-from-unicode-in-c 0 95258 - 95258
/path/to/pypy2-HEAD/bin/pypy -mpip install pyprof2calltree
/path/to/pypy2-HEAD/bin/pypy -mcProfile -o /tmp/sphinx.prof runner.py --fast -b sphinx
# wait ~90 secs
/path/to/pypy2-HEAD/bin/pypy -mpyprof2calltree -i /tmp/sphinx.prof -k
@mattip
mattip / gist:a65fcb97151e9e089eb0b994f94b75b7
Created September 22, 2019 12:32
add to module/time/test/test_time.py
class AppTestLocaleTime:
spaceconfig = {
"usemodules": ['time', '_locale'],
}
def test_strftime_locale(self):
# issue bb-3079
import time, _locale, os
oldlocale = os.environ.get('LC_TIME', None)
_locale.setlocale(_locale.LC_TIME, 'fr_FR')
@mattip
mattip / code.js
Last active February 16, 2019 16:24
Recreating the speed.pypy.org bottom plot. The runner script forces two iterations "base" and "changed", and does not write the sys.version_info of each
// This is the code from codespeed https://github.com/mattip/codespeed/blob/5a3bb8ca11e6468a515a4550198d6c21870210ba/example/templates/home.html#L94
// Prepare and render second plot
var geomeans = [1.0];
var num_of_benchs = 0;
for (var i in data['tagged_revs']) {
num_of_benchs = tagged_data[i].length;
var tempgeo = 1;
for (var j in tagged_data[i]) {
tempgeo *= tagged_data[i][j];
@mattip
mattip / benchmarks.rst
Created February 9, 2019 07:42
pypy2 v7.0 vs pypy2 with regalloc branch

+-----------------+---------+------------------------------+------------------------------+------------------------------+ | Benchmark | pypy2_1 | pypy2regalloc_1 | pypy2regalloc_2 | pypy2regalloc_3 | +=================+=========+==============================+==============================+==============================+ | crypto_pyaes | 5.62 ms | not significant | 5.92 ms: 1.05x slower (+5%) | not significant | +-----------------+---------+------------------------------+------------------------------+------------------------------+ | json_loads | 12.2 us | not significant | not significant | 11.6 us: 1.05x faster (-5%) | +-----------------+---------+------------------------------+------------------------------+------------------------------+ | logging_silent | 0.10 ns | 0.05 ns: 1.91x faster (-48%) | 0.05 ns: 1.91x faster (-48%) | 0.05 ns: 1.91x faster (-48%) | +-----------------+---------+-----------

@mattip
mattip / pypy2_to_pypy3utf.rst
Last active February 7, 2019 20:53
pypy3utf8 speed comparison to pypy2.7v7.0, pypy3.5v7.0

I ran the python performance suite (not our benchmark suite) 3 times for pypy2, pypy3 v7.0 and pypy3 unicode-utf8

for i in seq 1 3; do pyperformance run --python=$python -o $prefix$i.json; done

python -mperf compare_to pypy3_1.json pypy2_1.json pypy3utf8*.json--min-speed 5 --table

Benchmark pypy2_1 pypy3utf8_1 pypy3utf8_2 pypy3utf8_3
2to3 896 ms 1.36 sec: 1.52x slower (+52%) 1.36 sec: 1.52x slower (+52%) 1.36 sec: 1.51x slower (+51%)
@mattip
mattip / pypy2_to_pypy2utf8.rst
Last active February 7, 2019 08:34
PyPy 2 utf8 and cpython speed comparisons

I ran the python performance suite (not our benchmark suite) 3 times for pypy2 v7.0 and pypy2 unicode-utf8

for i in seq 1 3; do pyperformance run --python=$python -o $prefix$i.json; done

python -mperf compare_to python2_1.json pypy2*.json --min-speed 5 --table

Benchmark pypy2_1 pypy2utf8_1 pypy2utf8_2 pypy2utf8_3
2to3 896 ms 972 ms: 1.09x slower (+9%) 978 ms: 1.09x slower (+9%) 978 ms: 1.09x slower (+9%)
@mattip
mattip / cppyy.diff
Created January 23, 2019 20:56
diff to fix test_site
diff -r 49aade4a2c18 pypy/module/_cppyy/pythonify.py
--- a/pypy/module/_cppyy/pythonify.py Sun Jan 20 19:10:23 2019 +0200
+++ b/pypy/module/_cppyy/pythonify.py Wed Jan 23 22:55:42 2019 +0200
@@ -1,8 +1,10 @@
# NOT_RPYTHON
# do not load _cppyy here, see _post_import_startup()
-import types
import sys
+class _C:
@mattip
mattip / gist:05be0be1ef0f169e0ff96bf0cafc9404
Last active January 10, 2019 15:35
py3.5 comparison to unicode-utf8-py3 and pypy2 comparison to unicode-utf8-py3
I ran the python performance suite (not our benchmark suite) 3 times for each pypy3 latest nightly and pypy3
on the unicode-utf8-py3 branch commit 95595-316992f1c55d
for i in `seq 1 3`; do pyperformance run --python=pypy-c-jit-95576-f638e10d6074-linux64/bin/pypy3 -o pypy3_$i.json; done
for i in `seq 1 3`; do pyperformance run --python=pypy-c-jit-95575-82d3ff852926-linux64/bin/pypy3 -o pypy3utf8_$i.json; done
python -mperf compare_to pypy3*.json --min-speed 5
2to3
====
@mattip
mattip / gist:38423f71bd0f799182021f7dc1243064
Last active January 6, 2019 16:01
pypy2 comparison to unitcode-utf8
I ran the python performance suite (not our benchmark suite) 3 times for each pypy2 latest nightly and pypy2
on the unicode-utf8 branch
for i in `seq 1 3`; do pyperformance run --python=pypy-c-jit-95546-0679f7b21b79-linux64/bin/pypy -o pypy2_$i.json; done
for i in `seq 1 3`; do pyperformance run --python=pypy-c-jit-95565-26a182fd648c-linux64/bin/pypy -o pypy2_utf8$i.json; done
python -mperf compare_to pypy2*.json
2to3