Screenshot( not really needed, but I posted one anyway )
For those who're lazy( like me ) you can download with the command below
pastebin get 90kzBp0P benchmark
Direct link: http://pastebin.com/90kzBp0P
pastebin get 90kzBp0P benchmark
Would it even be worth it?I'd of expected it to be a slightly higher difference - it is one array index operation rather than 3 or 4 hashmap lookups (first in the environment, then for __index in the metatable, then in the parent environment). It might be interesting to check other micro-optimisations (a * (1/3) vs a / 3, a * a vs a ^ 2, etc…).
That's what I've always wondered… I'm not sure if LuaJ implements constant folding so a * (1/3) might not even have an effect. a * a is quicker than a ^ 2 but I don't know by how much.Would it even be worth it?I'd of expected it to be a slightly higher difference - it is one array index operation rather than 3 or 4 hashmap lookups (first in the environment, then for __index in the metatable, then in the parent environment). It might be interesting to check other micro-optimisations (a * (1/3) vs a / 3, a * a vs a ^ 2, etc…).
Thanks for the feedback, but this was mostly only made to demonstrate why it's better to use locals, as it can speedup slow programs.- snip -
It's really not the most important thing they could learn–not when they're trying to learn functions, how strings and numbers work, string manipulation, etc. It sorta comes toward the end of the basics, and that's because the programs will at least function without locals.Thanks for the feedback, but this was mostly only made to demonstrate why it's better to use locals, as it can speedup slow programs.- snip -
Most new users on these forums tend to not use locals, which is kind of annoying sometimes, but it was the same with me when I was new here :P/>
I've got a Intel(R) Core(TM) i5-4300M @ 2.60GHz, but I'm on my school laptop so I'm not surprised :P/>haha I finished quite a bit faster than you. My processor(I don't think graphics or RAM really matter to CC) is an i5 quad-core @ 3.5GHz. What's yours?
TOBIT explained it pretty well here: http://www.computercraft.info/forums2/index.php?/topic/15650-repeating-a-function-every-minute/page__view__findpost__p__150185How come local are faster than globals?
So, you have a school laptop and a not school laptop? And the school laptop is that good?I've got a Intel® Core™ i5-4300M @ 2.60GHz, but I'm on my school laptop so I'm not surprised :P/>haha I finished quite a bit faster than you. My processor(I don't think graphics or RAM really matter to CC) is an i5 quad-core @ 3.5GHz. What's yours?TOBIT explained it pretty well here: http://www.computerc...post__p__150185How come local are faster than globals?
Well yeah, it's surprisingly good for a school laptop, it's one of the perks of going in an IT school :P/>So, you have a school laptop and a not school laptop? And the school laptop is that good?
what?!?!So, you have a school laptop and a not school laptop? And the school laptop is that good?
what?!?!So, you have a school laptop and a not school laptop? And the school laptop is that good?
You've just said he has a school laptop and not a school laptop…
a non-school laptop
What I think he meant with that is that it's better than ordinary school laptops( I think ).-snip-
What I meant is that you have a very good school laptop. And alone the fact that you have a laptop for yourself from the school surprises me.What I think he meant with that is that it's better than ordinary school laptops( I think ).-snip-
Well that's going in a school in sweden gets you, especially when it's an IT school! :D/> :P/>What I meant is that you have a very good school laptop. And alone the fact that you have a laptop for yourself from the school surprises me.
Well that's going in a school in sweden gets you, especially when it's an IT school! :D/> :P/>What I meant is that you have a very good school laptop. And alone the fact that you have a laptop for yourself from the school surprises me.