Quote (Paren) Benchmark
[1/3] from: robbo1mark::aol::com at: 13-Dec-2001 4:49
Further to my post yesterday about the usefulness
of the 'quote function when used to define words
to evaluating expressions (parens!) as opposed
to 'does functions, I've done some simple
benchmarking here with two words which do nothing.
The quote paren word 'a is 100% faster in these
circumstances than the word 'b does function version.
Anyone care to try out some more heavy duty benchmarking
to see what avarage speed gains are overall by coding
without function calls?
the bechmark test code is below,
cheers,
Mark Dickson
>> quote: func ['value] [return :value]
>> a: quote ()
== ()
>> b: does []
>> b
>> a
>> print c: now/time loop 100000000 [a] print d: now/time prin
t [d - c "elapsed"]
9:33:46
9:34:03
0:00:17 elapsed
>> print c: now/time loop 100000000 [a] print d: now/time prin
t [d - c "elapsed"]
9:34:12
9:34:29
0:00:17 elapsed
>> print c: now/time loop 100000000 [b] print d: now/time prin
t [d - c "elapsed"]
9:34:36
9:35:10
0:00:34 elapsed
>> print c: now/time loop 100000000 [b] print d: now/time prin
t [d - c "elapsed"]
9:35:22
9:35:56
0:00:34 elapsed
[2/3] from: greggirwin:mindspring at: 13-Dec-2001 11:53
Hi Mark,
<< The quote paren word 'a is 100% faster in these
circumstances than the word 'b does function version.
Anyone care to try out some more heavy duty benchmarking
to see what avarage speed gains are overall by coding
without function calls? >>
The speed gains will be based on the amount of work you're doing in the
functions relative to the overhead of a function call. I.e. your benchmark
shows the maximum speed gain because the function call overhead should be
the only difference. If you put code in that takes 100 times as long to
execute as a function call, the speed gain will be minimal as the function
call overhead is such a small part of the big picture.
If you're using it in place of lots of simple little functions, it should
provide a good boost. I've already tried it out (not for benchmarking
purposes) and can see some really good uses for it. Another handy tool in
the toolbag.
Thanks!
--Gregg
[3/3] from: doug:vos:eds at: 13-Dec-2001 15:05
Sounds really good.
Please provide some script snips.