Skip to content

Instantly share code, notes, and snippets.

0xb635af7996cb6b8fe113f88f5a6846cc4a8fb083
@devrim
devrim / gist:d13fd5b854101c012be972faaa3c10fd
Created February 12, 2018 18:02
fail after 12M insertion
<--- Last few GCs --->
[83252:0x102801e00] 10819832 ms: Mark-sweep 1373.1 (1426.8) -> 1373.1 (1426.8) MB, 689.2 / 0.0 ms allocation failure GC in old space requested
[83252:0x102801e00] 10820615 ms: Mark-sweep 1373.1 (1426.8) -> 1373.1 (1425.8) MB, 674.8 / 0.0 ms last resort GC in old space requested
[83252:0x102801e00] 10821423 ms: Mark-sweep 1373.1 (1425.8) -> 1373.1 (1425.8) MB, 807.3 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
$ = require "jquery"
pako = require('pako')
bz2 = require('unbzip2-stream')
BrowserStdout = require('browser-stdout')
decoder = new TextDecoder("utf-8")
stream = new WritableStream
@devrim
devrim / throttle.py
Created December 7, 2023 20:02
python throttling
import time
def create_throttled_function(func, period):
"""Creates a throttled version of the given function that can only be called once every 'period' seconds."""
last_called = [0]
def throttled_function(*args, **kwargs):
nonlocal last_called
current_time = time.time()