At 05:43 PM 7/26/2006 -0400, Sylvain Fourmanoit wrote: > > The loading code could also be made a lot faster by using a dictionary > > mapping AST node types to functions, instead of doing string > > manipulation for each node. Each function could take 'pedantic' as a > > parameter, which would eliminate the need to have an object at all, let > > alone a singleton. > > >I am not convinced the current string manipulation for mapping the nodes >types to the methods of the _Load class has such a significant impact on >performance, but I will test your suggestion... I haven't tested this with your code specifically, but I know that in the past I have nearly tripled the speed of AST-visiting code by doing this; string manipulation plus attribute lookup is a lot more expensive than direct dictionary lookups. > The only difference with >current code is that we use a dynamically computed string as the >dictionary key to locate the function instead of the node type themselves >as keys. Actually you're doing string manipulation plus an *attribute* lookup, and attribute lookups can involve multiple dictionary lookups. But anyway, test and see what you get. :) >But I agree this looks a lot like JSON, since ecmascript syntax for >literals looks a lot like the one of Python... For the same reasons there >is a need for JSON, I think having something like miniconf in the >standard lib would benefit the users. Actually, I would see more reason to include JSON in the standard library, since it's at least something approaching an internet protocol these days.
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