[Closed] what can we do with mxs arrays? (SDK)
the only way to organize and publish class methods in mxs is to use the mixin interfaces, but calling these methods in the “simple” mxs syntax results in a loss of performance and memory:
for example:
delete objects
b = converttopoly (box())
gc()
-- 'plain' syntax:
(
t0 = timestamp()
h0 = heapfree
for k=1 to 1000 do
(
b.selectHardEdges()
)
format "#1 time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)
-- the very well known trick:
(
t0 = timestamp()
h0 = heapfree
selectHardEdges = b.selectHardEdges
for k=1 to 1000 do
(
selectHardEdges()
)
format "#2 time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)
that’s why I don’t like to use interfaces
in SDK of course I have class methods for this mxs classes, and use them. but I don’t publish them for MXS.
if I wanted to publish them, I would have to add an interface to code that I absolutely do not need in relation to the SDK
Thanks a lot.
Now it’s at least clear why I couldn’t make my methods exposed to mxs.
Worth mentioning there’s no need for that trick as you can always use
Editable_Poly.selectHardEdges b
I finally made it using the example by Rodrigue Cloutier provided in ancient Descreet Sparks chm.
sparks_archive.chm (3.3 MB) source
ps. Why there’s still no sticky thread for c++ faq ?