SyncViewS
11-02-2009, 06:58 PM
Hi guys, I'd like to run some tests on common Editable Poly functions for the sake of speed and memory optimization. I wish to know if the test structure I coded seems up to the task for fair results, and more extensive tests. Any suggestion is very welcome. Thanks.
struct PerformanceTester
(
iStartMem = 0,
iStartTime = 0,
iStopMem = 0,
iStopTime = 0,
iCycle = 0,
iResTime = 0,
iResMem = 0,
function start =
(
gc()
iCycle += 1
iStartMem = (heapSize - heapFree)
iStartTime = timeStamp()
),
function stop =
(
iStopTime = timeStamp()
iStopMem = (heapSize - heapFree)
iResTime += ((iStopTime - iStartTime) / 1000.0)
iResMem += ((iStopMem - iStartMem) / 1024.0)
),
function report =
(
format "Average processing on % iteration(s) took:\n" iCycle
format "% seconds\n" (iResTime / iCycle)
format "% Kbytes\n\n" (iResMem / iCycle)
iCycle = 0
iResTime = 0
iResMem = 0
)
)
Follows a test on one of most used polyOp methods: getVert()
-- polyOp.getVert TEST
(
local theWatch = PerformanceTester()
local gv = polyOp.getVert
local theSphere = convertToPoly(Sphere segments:200)
local iNumVerts = polyOp.getNumVerts theSphere
for i = 1 to 100 do
(
theWatch.start()
for j = 1 to iNumVerts do
(
polyOp.getVert theSphere j
)
theWatch.stop()
)
theWatch.report()
-- Average processing on 100 iteration(s) took:
-- 0.03749 seconds
-- 1272.57 Kbytes <-- memory leak?
for i = 1 to 100 do
(
theWatch.start()
for j = 1 to iNumVerts do
(
gv theSphere j
)
theWatch.stop()
)
theWatch.report()
-- Average processing on 100 iteration(s) took:
-- 0.02917 seconds <-- greater speed
-- 0.226563 Kbytes <-- lower memory consumption
delete theSphere
)
- Enrico
struct PerformanceTester
(
iStartMem = 0,
iStartTime = 0,
iStopMem = 0,
iStopTime = 0,
iCycle = 0,
iResTime = 0,
iResMem = 0,
function start =
(
gc()
iCycle += 1
iStartMem = (heapSize - heapFree)
iStartTime = timeStamp()
),
function stop =
(
iStopTime = timeStamp()
iStopMem = (heapSize - heapFree)
iResTime += ((iStopTime - iStartTime) / 1000.0)
iResMem += ((iStopMem - iStartMem) / 1024.0)
),
function report =
(
format "Average processing on % iteration(s) took:\n" iCycle
format "% seconds\n" (iResTime / iCycle)
format "% Kbytes\n\n" (iResMem / iCycle)
iCycle = 0
iResTime = 0
iResMem = 0
)
)
Follows a test on one of most used polyOp methods: getVert()
-- polyOp.getVert TEST
(
local theWatch = PerformanceTester()
local gv = polyOp.getVert
local theSphere = convertToPoly(Sphere segments:200)
local iNumVerts = polyOp.getNumVerts theSphere
for i = 1 to 100 do
(
theWatch.start()
for j = 1 to iNumVerts do
(
polyOp.getVert theSphere j
)
theWatch.stop()
)
theWatch.report()
-- Average processing on 100 iteration(s) took:
-- 0.03749 seconds
-- 1272.57 Kbytes <-- memory leak?
for i = 1 to 100 do
(
theWatch.start()
for j = 1 to iNumVerts do
(
gv theSphere j
)
theWatch.stop()
)
theWatch.report()
-- Average processing on 100 iteration(s) took:
-- 0.02917 seconds <-- greater speed
-- 0.226563 Kbytes <-- lower memory consumption
delete theSphere
)
- Enrico
