Yeah, there's definitely some things that could be done better.

 

We could just access the private _columns (just kidding, although I see
we do that in places as well)

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of reflexactions
Sent: Saturday, October 20, 2007 12:03 AM
To: [email protected]
Subject: [flexcomponents] Re: DataGrid column access

 

Ok good to know,

"cache the set from the DG "
Yeah thats what I thought as well...

Performance hit maybe not be bad by itself but I did see some code 
that looped the over the columns array:

for(.. columns.length ...)columns[i]

So on every loop you duplicate the array once for the length check 
and once again for the access and on a 20+column array that starts to 
add up...

tks
--- In [email protected]
<mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> 
wrote:
>
> Yeah, you're making a copy every time. Shouldn't be a major 
performance
> hit as it doesn't clone the column objects, it just makes a new 
array of
> references to them.
> 
> 
> 
> If you have to get at them often, you might want to keep a 
reference to
> the set you passed in, or cache the set from the DG unless you 
think it
> is going to change often.
> 
> 
> 
> ________________________________
> 
> From: [email protected]
<mailto:flexcomponents%40yahoogroups.com> 
> [mailto:[email protected]
<mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of reflexactions
> Sent: Friday, October 19, 2007 11:10 PM
> To: [email protected]
<mailto:flexcomponents%40yahoogroups.com> 
> Subject: [flexcomponents] DataGrid column access
> 
> 
> 
> I am working on a DataGrid subcomponent and have been accessing the 
> columns array frequently, thinking nothing of it I just do 
something 
> like:
> 
> ... columns[i] ...
> 
> but then I saw that the columns getter function does a 
_columns.slice
> (0).
> 
> Is the compiler smart enough to figure out i dont really want to 
clone 
> the columns array every time I access it or am I really forcing it 
to 
> copy the array?
> 
> tks
>

 

Reply via email to