Skip to content

Instantly share code, notes, and snippets.

View msalvadores's full-sized avatar

Manuel Salvadores msalvadores

View GitHub Profile
@msalvadores
msalvadores / array_append_len_known.py
Last active December 15, 2015 08:09
A benchmark of two approaches to constructing an array. Bytearray vs array+join. Limitation: one should know the length of the array. Within pypy-1.9 the bytearray approach is one order of magnitude faster. In CPython-2.7, bytearray aprox. 35% faster.
import timeit
DATA = 'abcdef'
def bytearr():
bytesn = 1024 * 1024 * 5
s = bytearray(bytesn)
i = 0
while i < bytesn:
s[i] = DATA[i%len(DATA)]
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname