Created
July 28, 2021 09:02
-
-
Save mathieu-lacage/18bf3ae0ebfc106cedc68be318121751 to your computer and use it in GitHub Desktop.
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 json | |
import time | |
import sys | |
import unicodedata | |
import re | |
import gc | |
CHARACTER_WHITESPACE = '\u2581' | |
class MyHooks(object): | |
done = False | |
def on_gc_minor(self, stats): | |
pass | |
def on_gc_collect_step(self, stats): | |
pass | |
def on_gc_collect(self, stats): | |
print(gc.get_stats(True)) | |
hooks = MyHooks() | |
gc.hooks.set(hooks) | |
def read(filename): | |
with open(filename) as f: | |
for line in f: | |
yield json.loads(line) | |
def main(): | |
time.sleep(2) | |
l = read(sys.argv[1]) | |
l = [CHARACTER_WHITESPACE + re.sub('\s+', CHARACTER_WHITESPACE, i) for i in l] | |
time.sleep(5) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment