On 25 May 2009, at 19:16, Edward Z. Yang wrote:
> Excerpts from Geoffrey Sneddon's message of Sat May 23 10:40:26 > -0400 2009: >> - Investigate moving the whole state-machine to one big switch >> statement within the parse method (this shouldn't make the codebase >> messy, IMO, and it avoids the function call overhead, which is >> currently a non-negligible amount of our expense). > > I recall doing some light performance testing, and finding that the > switch statement ended up taking more time, because PHP will then > perform an O(n) lookup instead of a function hashtable lookup, and > the n factor ends up outweighing the reduced constant factor. I > recommend > doing some more benchmarks before putting in the effort of doing this. I did this earlier today, and it caused a ~20% perf. improvement (I had already got it down to the point that the function call overhead was a large part of the total cost, of which doing the look-up in the hash-table is a small part). While talking of function call overhead, the biggest single gain was doing more greedy grabbing of data, and that really got its large gain through cutting out function calls (IIRC it removed something along the order of 1,000,000 function calls when tokenizing the spec). (Also, doing it wasn't much effort, as I had through my prior work got it into a state where I could basically do a find-and-replace on "private function …State() {" then manually go through and add each of the needed break statements, so it only took around ten minutes to do.) Finally, I'll probably move the tokenizer to being an iterator this weekend, mainly so we can have a single implementation of emitToken(), which should remove the majority of the duplication within the tests (and it should get nine out of the current ten failing tests passing, i.e., those relating to duplicate attributes/end tag attributes). Then I'll try and get a working tree-builder. -- Geoffrey Sneddon <http://gsnedders.com/> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "html5lib-discuss" group. To post to this group, send email to html5lib-discuss@googlegroups.com To unsubscribe from this group, send email to html5lib-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/html5lib-discuss?hl=en-GB -~----------~----~----~----~------~----~------~--~---
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4