Skip to content

Instantly share code, notes, and snippets.

@yamionp
Created July 27, 2015 16:02
Show Gist options
  • Save yamionp/0d02caa0f9179d749430 to your computer and use it in GitHub Desktop.
Save yamionp/0d02caa0f9179d749430 to your computer and use it in GitHub Desktop.
import time
import os
DATA = 'aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd'*100000
def main():
with open('/tmp/test.log', 'w') as f:
for i in xrange(1000):
start_at = time.time()
f.write(DATA)
f.flush()
os.fsync(f.fileno())
print '{0:>10}\t{1:d}'.format(i, int((time.time() - start_at)*1000))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment