[development] behaviors context

Daniel F. Kudwien news at unleashedmind.com
Fri May 29 19:59:29 UTC 2009


> re: performance... in most cases you are talking a negligible 
> difference. DOM optimization in mainstream browsers is good 
> enough that a search through an entire document is almost 
> always "fast enough". Shaving 10 msecs off of that time isn't 
> going to make much of a difference (assuming you could 
> actually shave that much from the search time).

Now, you do the math:

10 ms * ~20+ behaviors = 200+ ms

With each module/behavior you add, the performance gets worse.

> There are two patterns in Drupal JS to "prevent" the same 
> behavior from processing the same data twice. One is the 
> :not(processed-X) pattern, which seems to be pretty reliable, 
> and is pretty much entirely in the hands of the author of the 
> behavior (barring a misanthrope who decides to remove your 
> processed classes).

...which equally cannot solve your trivial zebra-striping table row example.
Once your table :is(.processed), your behavior can't (shouldn't) process it
again.

sun



More information about the development mailing list