performance improvements for 1.3
Jonathan Swartz <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm going to check into 1.3 a set of performance improvements based on work at Amazon over the past month. Some methods have been significantly rewritten and there are a few minor backward incompatibilities, but I believe it'll be well worth it. The main focus has been to reduce component call overhead as much as possible. Don't have any reportable numbers yet wrt improvements. I'll try our checked-in benchmarks before and after the changes, but really, the speed-up will vary greatly from site to site depending on the quantity and pattern of component calls. Summary of changes: * Replace the Buffer object with a simple scalar, and replace the generated $m->print() call in components with in-line concatenation unless autoflush is enabled. * Delay computation of base_comp for each stack frame until it is needed. * Create a cache from the uncanonicalized paths used to call components (e.g. <& foo/bar.m &>) into actual component objects when in static_source mode. * Make the request stack a dynamically scoped array, so that it does not have to be manually popped after each component. * Make each request stack frame an array rather than a hash. * Allow preallocation of output buffer to a large string to reduce unnecessary mallocs. * Determine if we are in Perl debugger at compile time, and don't call debug hooks unless we are. Backward incompatibilities: * Can no longer print a list inside <% %>, e.g. <% @foo %>, because these tags are now translated into simple in-line concatenations. This is no great loss since you can just use a join. If people think it is warranted, we can continue to support this syntax (and disable the optimization) for a limited time via a special compiler flag. * A new parameter, enable_autoflush, must be passed to the compiler or interpreter in order for autoflush to work. Again, this is to support simple in-line concatenations. If you use autoflush on just a few pages on your site, it is probably better to manually call $m->flush_buffer than incur this penalty for all components. This is being tracked in todo item #555. Watch for the code check-ins soon, and please comment as you see fit. Jon ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php