losbellos
02-18-2009, 08:09 AM
Hi There,
I guess everyone is interested in the subject a bit.
So, it is still about a geometry exporter. I figured out, if I fill an array withe vertex data it fills extremly quick, and then I will print that out into a file, I will have at least 20-30% performance gain. Now, when I tried to do that in two task at the same time, then the performace dropped 3-400%, I am puzzled, is that possible that maxscript can work only on one array at a time? Here is a very simplified situation below. There is two object $t1 and $t2 (two teapots). So it will cycle through the vertices and then put them formatted into an array. Is that also possible that the getvert command creating the slowdown?
Thanks a lot!
clearlistener()
Global Thread, MainThread, SecondaryThread
global str=#()
global str2=#()
fn geom1 = (
time1 = timestamp()
obj = $t1
nverts = obj.numverts
for i=1 to nverts do (
vert = getvert obj i
str[i] = "vertex"+ " " + vert[1] as string + vert[2] as string + vert[3] as string
)
time1b = timestamp()
finish = (time1b-time1)/1000 as float
print "FIRST TASK"
print finish
)
fn geom2 = (
time2 = timestamp()
obj2 = $t2
nverts2 = obj2.numverts
for k=1 to nverts2 do (
vert2 = getvert obj2 k
str2[k] = "vertex"+ " " + vert2[1] as string + vert2[2] as string + vert2[3] as string
)
time2b = timestamp()
finish2 = (time2b-time2)/1000 as float
print "SECOND TASK"
print finish2
)
MainThread = dotnetobject "System.ComponentModel.BackGroundWorker"
MainThread.WorkerSupportsCancellation = true
dotNet.addEventHandler MainThread "DoWork" geom1
--------------------
SecondaryThread = dotnetobject "System.ComponentModel.BackGroundWorker"
SecondaryThread.WorkerSupportsCancellation = true
dotNet.addEventHandler SecondaryThread "DoWork" geom2
-----------------------
MainThread.RunWorkerAsync()
SecondaryThread.RunWorkerAsync()
I guess everyone is interested in the subject a bit.
So, it is still about a geometry exporter. I figured out, if I fill an array withe vertex data it fills extremly quick, and then I will print that out into a file, I will have at least 20-30% performance gain. Now, when I tried to do that in two task at the same time, then the performace dropped 3-400%, I am puzzled, is that possible that maxscript can work only on one array at a time? Here is a very simplified situation below. There is two object $t1 and $t2 (two teapots). So it will cycle through the vertices and then put them formatted into an array. Is that also possible that the getvert command creating the slowdown?
Thanks a lot!
clearlistener()
Global Thread, MainThread, SecondaryThread
global str=#()
global str2=#()
fn geom1 = (
time1 = timestamp()
obj = $t1
nverts = obj.numverts
for i=1 to nverts do (
vert = getvert obj i
str[i] = "vertex"+ " " + vert[1] as string + vert[2] as string + vert[3] as string
)
time1b = timestamp()
finish = (time1b-time1)/1000 as float
print "FIRST TASK"
print finish
)
fn geom2 = (
time2 = timestamp()
obj2 = $t2
nverts2 = obj2.numverts
for k=1 to nverts2 do (
vert2 = getvert obj2 k
str2[k] = "vertex"+ " " + vert2[1] as string + vert2[2] as string + vert2[3] as string
)
time2b = timestamp()
finish2 = (time2b-time2)/1000 as float
print "SECOND TASK"
print finish2
)
MainThread = dotnetobject "System.ComponentModel.BackGroundWorker"
MainThread.WorkerSupportsCancellation = true
dotNet.addEventHandler MainThread "DoWork" geom1
--------------------
SecondaryThread = dotnetobject "System.ComponentModel.BackGroundWorker"
SecondaryThread.WorkerSupportsCancellation = true
dotNet.addEventHandler SecondaryThread "DoWork" geom2
-----------------------
MainThread.RunWorkerAsync()
SecondaryThread.RunWorkerAsync()
