Created
May 19, 2020 04:58
-
-
Save Almenon/77a1f345e8d36b959ec9c055a3044d59 to your computer and use it in GitHub Desktop.
node_buffer_issue_python_script
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 sys | |
from time import sleep | |
# numBytes = 2 ** 29 | |
# sys.stdout.write("a" * numBytes) | |
# only one flush | |
# sys.stdout.write("a") | |
# sys.stdout.flush() | |
# sleep(0.000000000000001) | |
# less than a picosecond, nonsense number. But the ~6ms it takes to invoke sleep and return is enough delay for node to process flush | |
# sys.stdout.write("aa") | |
# sys.stdout.flush() | |
# this block results in two flushes | |
# for i in range(8192 * 2 + 2): | |
# sys.stdout.write("a") | |
# 2 flushes | |
# for i in range(2): | |
# sys.stdout.write("a" * (8192 + 1)) | |
# two flushes | |
# sys.stdout.write("a" * (8192 + 1)) | |
# sys.stdout.write("a" * (8192 + 1)) | |
# two flushes | |
sys.stdout.write("a" * (8192 * 2 + 2)) | |
# one flush | |
sleep(3) | |
print("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment