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 / 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 / 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 / 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 / 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')
/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: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
@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) {
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:aca31b74e5373fc6f7273950aa735949
Last active February 7, 2021 07:33
benchmark for str.replace
import random
import pyperf
def create_data(fname='/tmp/lines.txt'):
printable = tuple(c for c in (chr(i) for i in range(32, 0x110000)) if c.isprintable() and not c.isspace())
with open(fname, "w", encoding="utf8") as f:
for _ in range(10000):
f.write("".join(random.choices(printable, k=random.randint(1000, 10000))))
f.write("\n")
@mattip
mattip / test.py
Last active May 18, 2021 05:57
Comparison of jit summary before and after py3.7-cpyext-unroll-a-bit 1f4c96de61ee
BEFORE AFTER
[4e2f663bd9fe8] {jit-summary [4e2d5889878b8] {jit-summary
Tracing: 86 0.100334 Tracing: 78 0.113238
Backend: 74 0.031218 Backend: 66 0.032329
TOTAL: 1.515222 TOTAL: 1.509000
ops: 124400 ops: 123038
heapcached ops: 78660 heapcached ops: 79768
recorded ops: 39196 recorded ops: 40168
calls: 6160 calls: 5844
guards: 9656 guards: 10059