Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/RexxS/test
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} --[[ Comparative testing of how fast we can access values. empty = 0.00282 read a constant = 0.00274 100,000 empty loops = 0.00284 1,000,000 assign loops = 0.01328 10,000,000 assign loops = 0.0805 10,000,000 assign a numeric constant = 0.08234 10,000,000 assign a string constant = 0.08128 10,000,000 assign a variable = 0.0791 10,000,000 assign a table value, constant as index = 0.1456 10,000,000 assign a table value, variable as index = 0.16808 use: {{#invoke:Sandbox/RexxS/test |speed |1e7}} --]] p.speed = function(frame) local loops = tonumber(frame.args[1]) or 0 local x, y y = 1 local args = {} args[1] = 99 for i=1, loops do x = args.y end return os.clock() end --[[ Checking resolution of os.time() - current time It's 1 second --]] p.ostime = function(frame) return os.time() end --[[ Checking resolution of os.clock() - time taken to run program It's in 100 microseconds --]] p.osclock = function(frame) return os.clock() end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/RexxS/test/doc
(
edit
)