Have you tried VBScript?
I usually do my envelope related scripts in VBScript because it is way
faster than JScript (my main scripting language).

VBScript
selection(0).Envelopes(0).Weights.Array

is faster than

JScript
new VBArray( selection(0).Envelopes(0).Weights.Array )

and way way more faster than

JScript
selection(0).envelopes(0).Weights.Array.toArray()

I don't use Python, but in my tests, Python has been the slowest of the
three when dealing with envelopes, subcomponent arrays and a bunch of loops.

M.Yara


On Fri, May 31, 2013 at 10:29 PM, Eric Thivierge <[email protected]>wrote:

>  This takes even longer ~ 14 seconds. I really seems the slowness is
> simply accessing envelopeOp.Weights.Array.
>
> Any devs paying attention that could confirm that this is just a slow
> call? Would doing these operations in C++ be the only way to speed them up?
>
>
> # Python
> # =============================================
> from platform import system as OStype
> from time import clock
>
> xsi = Application
> log = xsi.LogMessage
> sel = xsi.Selection
>
> start_time = clock()
>
> envelopeOp = sel(0).Envelopes(0)
> weightsTuple = envelopeOp.Weights.Array
> weights = [weightsTuple[j][i] for i in xrange(len(weightsTuple[0])) for j
> in xrange(len(weightsTuple))]
>
>
> timeTaken = clock() - start_time
>
> units = ["seconds" if OStype() is "Windows" else "milliseconds"][0]
> msg = "It took "+str(timeTaken)+" "+units+" to process your code."
>
> log(msg)
> # =============================================
>
>
> Eric Thivierge
> ===============
> Character TD / RnD
> Hybride Technologies
>
>
> On 31/05/2013 3:00 AM, Bartosz Opatowiecki wrote:
>
> Also:
>
> def getWeights(envelopeOp):
>   weightsTuple = envelopeOp.Weights.Array
>  return [weightsTuple[j][i] for i in range(len(weightsTuple[0])) for j in
> range(len(weightsTuple))]
>
> xrange should be more efficient than range....
>
>
>

Reply via email to