Tom Bagby wrote: > Sorry, about overlooking things in the string literal parsing. > No worries. > prerender_static_tags.diff is probably the last in my series of > optimizations in this vein, heh. open_tag is by far the most > expensive buffer operation. This patch takes tags which have no > dynamic content, and prerenders them as text. > > Before: Haml/ERB: 1.97723 > After: Haml/ERB: 1.7577 > Sounds very good. Eventually this sort of thing will be unnecessary, as we'll be pre-rendering everything possible, but for now it's excellent. > To things you should probably note/decide about in the diff. I made > one_liner? a class method on Buffer so I could call it from Engine. I > cut & pasted build_attributes from Buffer to Engine to use in the > prerender. It has instance variables that make it unfriendly to being > a class method, I leave it to you how best to share this functionality > without repeating. > Duly noted. > I have two unrelated questions/suggestions: > > 1) In the TODO, it mentions wanting to: > >> Get rid of line number counting and make template lines one-to-one with >> precompiled lines >> > > I've benchmarked related to this, and it doesn't impact performance > much. Is that the only reason to get rid of this? My other > suggestion is that making a line for line matchup is tedious and error > prone. You've mentioned other reasons for keeping around the > precompiled templates. If those were always there, you could stub out > the @haml_lineno lines as comments, [EMAIL PROTECTED], you could then use > the same search strategy as for finding line no's of compile errors > with no impact on the runtime. > Interesting point. Yes, that was mostly for performance reasons (I thought you had done something before that suggested it was useful), so commenting is probably a better solution. > 2) What's the intended use of @tabulation in Buffer? It seems like > helpers can set it to do custom tabbing? A lot of time is spent > tabulating what could just be static pre-indented strings. Treating > extra tabulation as a special case is very fruitful for speeding > things up, so I just want to make sure my assumptions about why it's > used/useful are right. > Yes, the buffer @tabulation keeps track of extra tabs that can be set via helpers. This is used for stuff like modifying form_tag so it produces nice output, and could be treated as a special case.
- Nathan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
