Skip to content

Instantly share code, notes, and snippets.

@treeform
Last active June 2, 2020 19:14
Show Gist options
  • Save treeform/a0bf64af27b9423d93d31bb196723007 to your computer and use it in GitHub Desktop.
Save treeform/a0bf64af27b9423d93d31bb196723007 to your computer and use it in GitHub Desktop.
var str = newString(1001*3 + 1001*801*3 + 1001*801*501*3)
var i = 0
for foo in 0..100:
str[i] = 'f'
inc i
str[i] = 'o'
inc i
str[i] = 'o'
inc i
for bar in 0..800:
str[i] = 'b'
inc i
str[i] = 'a'
inc i
str[i] = 'r'
inc i
for baz in 0..500:
str[i] = 'b'
inc i
str[i] = 'a'
inc i
str[i] = 'z'
inc i
@treeform
Copy link
Author

treeform commented Jun 2, 2020

nim c -d:danger faststr.nim
time ./faststr 
1.30 real         0.45 user         0.33 sys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment