Created
September 8, 2013 20:59
-
-
Save cscorley/6488362 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from timeit import timeit | |
from ctypes import * | |
size = 10 | |
l = list() | |
arr = (c_int * size)() | |
def test(x): | |
for n in range(x): | |
l.append(n) | |
def testarr(x): | |
for n in range(x): | |
arr[n] = n | |
if __name__ == '__main__': | |
print(timeit("test(size)", setup="from __main__ import test, size")) | |
print(timeit("testarr(size)", setup="from __main__ import testarr, size")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment