Lately I have been crazy about jquery.
Maybe I abused a little but, I made an experience wich consisted in
replacing all my css rules(well, some basic css understandable for
ie6 ) for more intelligent 'styling rules' expressed with jquery.
Wow, I had a PORTABLE intelligent style engine.

But oups, even with some wise reuse of nodeset, when my page started
to grow, performance went down. Nothing critical but 2,3,4 seconds
just for jquery processing (on top of all the database access) is too
much since I have to reload the entire page on 90% of the user click.
Yea I know, I should use more ajax. Anyway ajax is another story.

Then while profiling this all I started to suspect that most of the
time was spent in the browser dom api. It is significative in the
whole performance discussion because if the browsers dom are too slow,
a siginificant performance boost for dom queries would be obtained by
caching the dom in an internal form.

In other words, dom queries would operate on a write-through dom
cache. And since you would probably put indexes everywhere to have
instantaneous getElementsByClass and getElementsByTagName on any node,
it would be in fact a sort of static dom analysis. (maybe indexes are
the real performance booster here)

Of course you might have to think about refreshing your dom analysis
but for the use case I started with (replacing css rules by wiser
jquery rules),  your dom is immutable so it is not an issue.

I tried to made a trivial ( or gory I am not sure anymore ) dom query
system with such dom static analysis to be used allong jquery. Nothing
very serious but results were there. Everything looked instantaneous.

So it raises a couple of questions.

Are the browsers api really slow?
Is IE7 css support enough to say that a nice n fast javascript style
engine would be useless?
Is there some dom query engine out there that work with a static
analysis of the DOM ?

Reply via email to