Re: Quaject-style run-time code synthesis for the Visitor pattern
Dave Long <[email protected]> Sat, 1 Jun 2013 17:57:58 +0200
| Newsgroups | gmane.culture.people.kragen.discuss |
|---|---|
| Message-ID | <[email protected]> |
> Suppose you want to be able to execute the Visitor pattern as quickly > as possible on some tree structure. You could compile your tree > structure into executable code, each node a subroutine which invokes a > method of the visitor object =97 traditionally each node type invokes a > different method =97 and then passes the visitor object to each child > node. My knee-jerk response is that waiting for i-cache misses is probably = not much faster than waiting for d-cache misses, and so it's probably = better to spend effort massaging your tree into a serialized form = suitable for traditional loops; I'd guess that the increased = instruction count is easily outweighed by the better prediction and = streaming. What kinds of results have you seen? -Dave (although if you squint at it properly, doing this kind of thing in = general is almost exactly what distinguishes compilers from = interpreters) -- = To unsubscribe: http://lists.canonical.org/mailman/listinfo/kragen-discuss