Note that looking up classes whose tag name == the class name is  
looking up the class name in a hash named `global`.

A switch statement is just syntactic sugar for an if/else cascade so  
it is O(n).  If you have a _really_ smart compiler, it _might_  
replace a large switch with b-tree or a hash lookup.  On the other  
hand, unless you have really botched your hash implementation, it  
should be O(1).  I'd also go with the hashmap because it avoids  
duplication -- if a new tag/class mapping gets invented, you only  
have to fix one place.

[That leaves open why we have the map at all.]

On 2006-09-06, at 21:24 EDT, Benjamin Shine wrote:

>
> Performance. ConstructorMap is about four times longer than the list
> that I'm using, with the delta being things that don't make sense to
> be styled with CSS.
>
> Maybe my idea of performance is wrong, though -- I'll measure which
> is faster, the switch statement or hashing into the ConstructorMap.
>
> -ben
>
> On Sep 6, 2006, at 5:44 PM, Jim Grandy wrote:
>
>> Why not simply use ConstructorMap in WEB-INF/lps/lfc/glue/
>> LaszloInitiator.as?


_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to