Created
February 21, 2014 06:23
-
-
Save westhood/9129712 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
| local ffi = require "ffi" | |
| local tick | |
| local n = 8000 | |
| local x = {} | |
| for i = 1, 8000 do | |
| x[i] = i | |
| end | |
| local a = ffi.new("int64_t [?]", n) | |
| tick = os.clock() | |
| for i = 1, 8000 do | |
| x[i] = i | |
| end | |
| print(os.clock() - tick) | |
| tick = os.clock() | |
| for i = 1, 8000 do | |
| x[i] = a[i] | |
| end | |
| print(os.clock() - tick) | |
| tick = os.clock() | |
| for i = 1, 8000 do | |
| x[i] = tonumber(a[i] + 1 - a[i]) | |
| end | |
| print(os.clock() - tick) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment