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:76be19a4cffab6991ee957059814d95a
Last active March 20, 2018 09:16
playing with clif and cppyy - WIP

This was done on Ubuntu 16.04

PyPY + CPPYY

create a pypy virtualenv virtualenv pypy2-v5.10/bin/pypy pypy_virt

activate it source pypy_virt/bin/activate

install cppyy to pypy pip install cppyy

ssh to speed-python.osuosl.org (chef credintials needed)
#once off: create a virtual env for running performance
virtualenv -p python3 cpython3_virt
virtualenv -p python cpython3_virt
cpython_virt/bin/pip install performace
cpython3_virt/bin/pip install performace
wget http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux64.tar.bz2
tar -xf pypy-c-jit-latest-linux64.tar.bz2 --strip-components=1 --directory=pypy2-latest
cpython_virt/bin/python -mperformance run --python pypy2-latest/bin/pypy --output json/bench-`date +%Y-%m-%d_%H-%M`.json
@mattip
mattip / gist:eec3dd590f7012764ff9fb534a986251
Created May 31, 2018 05:04
diff for gufunc-signature-modification2
diff --git a/doc/source/reference/c-api.types-and-structures.rst b/doc/source/reference/c-api.types-and-structures.rst
index dcebd1e..e92cb1e 100644
--- a/doc/source/reference/c-api.types-and-structures.rst
+++ b/doc/source/reference/c-api.types-and-structures.rst
@@ -133,9 +133,9 @@ PyArray_Type
is related to this array. There are two use cases: 1) If this array
does not own its own memory, then base points to the Python object
that owns it (perhaps another array object), 2) If this array has
- the (deprecated) :c:data:`NPY_ARRAY_UPDATEIFCOPY` or
+ the (deprecated) :c:data:`NPY_ARRAY_UPDATEIFCOPY` or
@mattip
mattip / objspace_std_unicodeobject.py
Created August 31, 2018 06:06
Translation Problem
[Timer] Timings:
[Timer] annotate --- 267.9 s
[Timer] rtype_lltype --- 548.2 s
[Timer] pyjitpl_lltype --- 81.2 s
[Timer] ==========================================
[Timer] Total: --- 897.4 s
[translation:info] Error:
File "/home/matti/pypy_stuff/pypy_35/rpython/translator/goal/translate.py", line 318, in main
drv.proceed(goals)
File "/home/matti/pypy_stuff/pypy_35/rpython/translator/driver.py", line 554, in proceed
@mattip
mattip / gist:d8d8c7b2bca3bfa8f8e44b18dfd42dd4
Last active September 17, 2018 10:22
f2py tests with a fixture fails to collect
platform linux -- Python 3.6.5, pytest-3.6.3, py-1.5.4, pluggy-0.6.0 -- /home/matti/cpython3_virt/bin/python
cachedir: ../../../../../.pytest_cache
benchmark: 3.1.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/matti/pypy_stuff/numpy2, inifile: pytest.ini
plugins: cov-2.5.1, benchmark-3.1.1
collected 5301 items / 1 errors / 167 deselected
===================================================================================== ERRORS =====================================================================================
______________________________________ ERROR collecting build/testenv/lib/python3.6/site-packages/numpy/f2py/tests/test_array_from_pyobj.py ______________________________________
../../../../../../cpython3_virt/lib/python3.6/site-packages/pluggy
@mattip
mattip / gist:bae62b026506b0bc220be2535964c9cc
Last active November 7, 2018 21:33
benchmarks for matmul commit 207fd8b3 vs 97df9287 (HEAD vs. master)
before after ratio
[97df9287] [207fd8b3]
+ 10.6±0.5ms 25.0±10ms 2.36 bench_linalg.Eindot.time_matmul_trans_a_at
+ 47.2±0.6ms 58.0±4ms 1.23 bench_app.MaxesOfDots.time_it
+ 1.89±0ms 2.08±0ms 1.10 bench_core.CountNonzero.time_count_nonzero_axis(2, 1000000, <type 'bool'>)
+ 2.81±0ms 3.09±0.01ms 1.10 bench_core.CountNonzero.time_count_nonzero_axis(3, 1000000, <type 'bool'>)
+ 142±20ms 156±5ms 1.10 bench_linalg.Linalg.time_op('pinv', 'complex128')
+ 904±20ns 988±20ns 1.09 bench_indexing.IndexingStructured0D.time_array_slice
+ 21.2±0.07μs 22.5±0.2μs 1.06 bench_io.Copy.time_cont_assign('complex128')
+ 622±6ns 658±10ns 1.06 bench_indexing.IndexingStructured0D.time_array_all
@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
@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 / 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 / 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