View bench_dict.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pyperf | |
def build_dict_str(n): | |
mydict = {str(k): k for k in range(n)} | |
return mydict, list(mydict) | |
def build_dict_int(n): |
View siphash.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create known hash in test_hash | |
#include <cstdint> | |
#include <iostream> | |
#include <stdio.h> | |
#include <stddef.h> | |
#include <string.h> | |
// copied from initconfig.c |
View set_doubled.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Objects/setobject.c b/Objects/setobject.c | |
index 2ccf183..db9b86b 100644 | |
--- a/Objects/setobject.c | |
+++ b/Objects/setobject.c | |
@@ -302,7 +302,7 @@ set_table_resize(PySetObject *so, Py_ssize_t minused) | |
setentry small_copy[PySet_MINSIZE]; | |
assert(minused >= 0); | |
- minused = (minused > 50000) ? minused * 2 : minused * 4; | |
+ minused *= 2; |
View render.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"time" | |
) |
View repository_pattern.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Generic, TypeVar, Optional | |
class BaseModel: | |
pass | |
M = TypeVar('M', bound=BaseModel) | |
View bench-citylots.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
from msgpack import fallback, packb | |
try: | |
from msgpack import _unpacker, _packer | |
has_ext = True | |
except ImportError: | |
has_ext = False | |
import timeit | |
View logbook-gzip-sample.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Compress FileHandler output with subprocess gzip. | |
""" | |
import subprocess | |
import logbook | |
from logbook.helpers import is_unicode | |
class GZFileHandler(logbook.FileHandler): |
View schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `TEST` ( | |
`id` int(11) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
INSERT INTO TEST (id) VALUES (1) (2) (3); |
View bench.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import json | |
bdata = b'{"foo0": "bar0","foo1": "bar1","foo2": "bar2","foo3": "bar3","foo4": "bar4","foo5": "bar5","foo6": "bar6"}' | |
udata = u'{"foo0": "bar0","foo1": "bar1","foo2": "bar2","foo3": "bar3","foo4": "bar4","foo5": "bar5","foo6": "bar6"}' | |
def decode_b(): | |
json.loads(bdata) |
View eintr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
import socket | |
import threading | |
import time | |
try: | |
import socketserver | |
except ImportError: | |
import SocketServer as socketserver | |
NewerOlder