Notifications
Clear all

[Closed] Detach Spline sections as a Copy

 JHN

@Zeboxx2 if you really want to optimize it you take away the braces in the where clause鈥?it will work without and doesn鈥檛 create extra scopes

-Johan

I鈥檓 being a smartass i know鈥?sorry鈥?/span>

smartassery notwithstanding鈥?

I don鈥檛 think I鈥檝e never seen a particular performance increase from not using parentheses vs using them; if anything, I鈥檝e seen a performance decrease in the scripter (me!) when having to poke at scripts that don鈥檛 use them鈥?code clarity is a good thing
It鈥檚 also highly subjective, of course鈥?waits for somebody to get confused by all the parentheses floating about

The only bit I changed in your script was to add isKindOf o splineShape (and vice-versa in mine, adding isKindOf o line); they鈥檙e pretty much the same thing in max, but the classes are mutually exclusive as far as maxscript is concerned. boo.

 JHN

Lets put it to the test


 (
 gc()
 o = selection[1]
 itterations = 1000000
 
 dumpArr = #{1..itterations}
 start = timestamp ()
 for i = 1 to itterations do
 	if isKindOf o SplineShape or isKindof o line then
 		dumpArr[i] = false
 end = timestamp ()
 format "it took % seconds to process (no braces)
" ((end-start)/1000.)
 
 dumpArr = #{1..itterations}
 start = timestamp ()
 for i = 1 to itterations do
 	if (isKindOf o SplineShape) or (isKindof o line) then
 		dumpArr[i] = false
 end = timestamp ()
 format "it took % seconds to process (some braces)
" ((end-start)/1000.)	
 	
 dumpArr = #{1..itterations}	
 start = timestamp ()
 for i = 1 to itterations do
 	if ((isKindOf o SplineShape) or (isKindof o line)) then
 		dumpArr[i] = false
 end = timestamp ()
 format "it took % seconds to process (all braces)
" ((end-start)/1000.)
 )
 

returns:
it took 3.485 seconds to process (no braces)
it took 3.563 seconds to process (some braces)
it took 3.531 seconds to process (all braces)

Very inconclusive鈥?so your right! You鈥檙e the smartassest of us all
Funny though I seem to remember reading somewhere it was faster on runtime to use as little braces as possible鈥?too keep the scope overhead low. So or maybe my test is wrong, or it doesn鈥檛 effect the overhead in a big way in this particular case鈥?/p>

Back to my CA鈥檚
Sorry for hijacking the thread鈥?br>
-Johan

They probably optimized the JIT compiler (I do presume it uses a JIT) a bit since the early days; back when MaxScript had all sorts of scoping issues fun

Back on-topic, indeed!
Jessup3D – is everything working the way you wanted it to work?

ZeBoxx2 – Yeah, it鈥檚 working great now. I appreciate the continued dialogue as well鈥?there鈥檚 always a lot that can be gleaned from the back and forth (the help file probably reads well to someone with a background in programming, but it pretty foreign to me still)

 JHN

You know what helped me alot in the helpfile鈥?if you search and find an topic you need via Index or search, switch back to the contents tab and you鈥檒l see under which topic it is put, and you can then use that to learn ftom the topic structure and find your way around the help faster鈥?(if the contents doesn鈥檛 show in which topic your page belongs switch back and click the search term again.)

That way you get a feeling as to how the helpfile is ordered.

-Johan

Page 2 / 2