Skip to content

Instantly share code, notes, and snippets.

View mattip's full-sized avatar

Matti Picus mattip

  • Quansight Labs
View GitHub Profile
diff --git a/cpp/src/arrow/python/datetime.cc b/cpp/src/arrow/python/datetime.cc
index 4eeab7f5a..9a7624ef7 100644
--- a/cpp/src/arrow/python/datetime.cc
+++ b/cpp/src/arrow/python/datetime.cc
@@ -74,6 +74,7 @@ bool MatchFixedOffset(const std::string& tz, util::string_view* sign,
} // namespace
+#ifndef PYPY_VERSION
PyDateTime_CAPI* datetime_api = nullptr;
@mattip
mattip / gist:75f97b4cbf639d892af47be49c468fe9
Last active August 28, 2020 14:49
searching affiliate websites
diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js
index 970d0d975..90fd3a0f6 100644
--- a/sphinx/themes/basic/static/searchtools.js
+++ b/sphinx/themes/basic/static/searchtools.js
@@ -107,6 +107,13 @@ var Search = {
this._queued_query = query;
},
+ setAffiliate : function(index) {
+ if (this._affiliates == null) {
@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%)
json_loads | 12.2 us | not significant | not significant | 11.6 us: 1.05x faster (-5%) |
@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

@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

@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: