Notifications
Clear all

[Closed] Benchmarker

 lo1

The latest mini challenge has inspired me to improve a tool I wrote once and constantly use when optimizing my scripts.

It is a loop benchmarker for maxscript, which makes it easier to compare execution times and memory usage of different blocks of code.

It also automatically outputs its code and results in a format that is compatible with this forum. (see example below):

Global declarations:
limit=10000

Method A:
random 1 limit

Method B:
random i limit

Method C:
(random i limit) as string

Output for 1000000 iterations:
Method A: Time: 0.417 Seconds, Memory: 0.0 KB, Time per iteration: 0.000417ms
Method B: Time: 0.403 Seconds, Memory: 0.0 KB, Time per iteration: 0.000403ms
Method C: Time: 1.91 Seconds, Memory: 344.414 KB, Time per iteration: 0.00191ms

Machine Specs:
3dsmax 2009 64bit
Heap size: 32.768 MB
Num. CPU cores: 8

edit: have not thoroughly tested it, would be happy to receive feedback/bugs

14 Replies

Great idea!

But just one thing, for example, in this particular method:

(
	print "V10 - Fisher-Yates shuffle"
	gc()
	mem = heapfree
	start = timestamp()
	seed(timestamp())
	
	asize = 1000000

	randoms = #()
	randoms[asize]=1
	randoms[1] = 1
	
	for i = 2 to asize do 
	(
		j = random 1 i
		randoms[i] = randoms[j]
		randoms[j] = i
	)
	
	end = timestamp()
	format "processing: % seconds heap: %
" ((end - start) / 1000.0) (mem-heapfree)
	format "Num unique elem %
" (randoms as bitarray).numberset
)

I want to start the iterator at 2 and not 1 as I believe it’s the default you have in your script, could we have a start, end for each method? I hope this makes sense. cheers!

 lo1

Sure, here you go.
You will need to restart max if you ran the previous version.

Ok, dunno if the last post is actually a good ideia, but I have other comments the datagrid where the results appear, after running the benchmark gets an vertical and horizontal scroll, making impossible for reading the three results without scrolling.

Other thing I think it’s missing is vertical scrollbars in the editboxes and the hability to multiple undo for each editbox

Thanks for this tool!

 lo1

Strange, that doesn’t happen here… will see if I can reproduce it.

The first request is implementable, the second is harder but I think also implementable

Haha, yeah I know, I’m just throwing ideas to help you improve it

 lo1

Not as complicated as I thought… had to write a small undo/redo system but seems to work fine.
And fixed the bug with the scrollbars.

Awesome! I used to keep a little script file around in which I’d have to paste my code I wanted to performance test, so this will certainly be an improvement! Going to try it out soon.

 lo1

Sure, glad to help. Thanks for the feedback.

i know how this kind of tool might be helpful. i use the similar one for many years. unfortunately i can’t post the tool but maybe how my tool looks like give you some new ideas.
also i’m open to answer any question.

now i’m thinking about new generation of the tool to support cases with multithreading.

Page 1 / 2