View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] Expand init arguments and custom destructor

From: Krzysztof Frukacz <frukacz.krzysztof_at_gmail.com>
Date: Tue, 08 Feb 2011 10:18:37 +0100

Hello Stefan,

On 02/08/2011 09:58 AM, Stefan Sobernig wrote:
> t.001: 26.2 mms, MyClass myObject $myList; set ::out
> t.002: 32.6 mms, eval MyClass myObject $myList; set ::out
> t.003: 26.9 mms, MyClass myObject 1 2 3 4; set ::out
> t.004: 26.0 mms, MyClass myObject {*}$myList; set ::out
>
> from this bird eye perspective (and without knowing the details of your
> scenario), you might want to consider avoiding the [eval] overhead by
> using the {*} operator in 8.5+ for the boxing case ...
>
> (t.003 is a kind of baseline measurement and appears slightly more
> expensive because the values in the argument vector must be turned into
> Tcl_Objs first etc., a conversion which has already been achieved if
> dealing with a [list] and its values).
>

Thank you for this example. I forgot to mention that my application
will, in some cases, create argument list that may be long (few thousand
integer values). I expect it to handle up to 7200 values that are
integers (2 digits maximum). Is it a bad idea to expand that list and
pass 7200 arguments to init?

In this example it appears that it is actually better to expend the list
using {*}, than to pass it as a value?

Best regards,
-- 
Krzysztof