"jbrave" wrote:
Might it possibly be more efficient & accurate to calculate the time from the time it entered the benchmark sub till it exits, and instead of using a call to the system time use rotimespan:
Like:
et=Eval(benchmark[0] + "(" + Stri(benchmark[1]) + ")")
function sieve(n) as integer
?"entered sieve"
timer=createobject("rotimespan")
timer.mark()
flags = CreateObject("roArray", 8192 + 1, true)
count = 0
while n > 0
n = n - 1
count = 0
for i = 2 to 8192
flags[i] = true
end for
for i = 2 to 8192
if (flags[i])
' remove all multiples of prime: i
for k = i + i to 8192 step i
flags[k] = false
end for
count = count + 1
end if
end for
end while
return timer.totalmilliseconds()
?"exiting sieve"
end sub
Also eval itself has some significant overhead I think, it compiles the code it is evaluating before it executes, so if you want to time the total process, wouldn't it be better to call the function directly, or at least do your timing within the functions being evaluated?
Just a thought, there is probably a good reason why you are doing it that way.
- Joel
good ideas and most likely i will make changes to code
i'm porting code that is written in other languages, this was quick, easy and dirty way.
this is what happens when you put quare peg in round hole...
i will go back and make better, most likely replace use of eval and just have long list of calls, i was just hacking down a bigger bench / test framework and tried to stick it with some simple screens.
notice the first call to bench to get base time... this is supposed to be removed from each call and it like takes out time spent in eval
then again im not sure about brightscript internals... i know how the languages that i have created and worked on work, but i know very little about brightscript, just started the other day.
i didnt use rotimespan because it looked like call to createObject would create an object and i would rather not instantiate objects which i then throw away. anyways the call i'm using appears to me to give accurate valies... but i will look eventually i will create benchmark test for it and then i can compare between one and the other... too bad i cant see how much memory im using..
i wish i had linux/c access... then i could see much more in asm/c debugger... too bad brightscript language is not open source. iscript has full exception handling / object oriented / ect... all the syntax sugar in the world. should not be too hard to add to brightscript...
i guess brightscript is what it is because i guess its for us to create simple screen savers and channels to glue the components they give us
and i guess some of the new components is for us to create (port) classic 2d games...
angry birds is fun... i tried it (too bad about patent lawsuit)
anyways i got to get some work done and then i'll play more with my new roku and the emulator stuff. i have a bit of work i must do on iscript so i can clear up time to undo my work so it can be more like iscript so it can be used in emulator... plus i still have to finish my work on all those components, i've done a good bit this weekend on creating mock objects, but there is still a lot more to do...
i wonder when i have this all done what i will do with all my little roku stuff. maybe port some game... that sounds fun. i like tower defense, should not be too hard. i have lots of sample code for games, mostly classic games...