On Jun 28, 2009, at 10:10 AM, Brice Figureau wrote:

>
> On 28/06/09 15:47, Luke Kanies wrote:
>> I have two questions about this:
>>
>> 1) Any idea how this affects performance?
>
> Interesting question. So I ran puppetdoc (which incidently uses the
> parser to parse every manifest) on the Days of Wonder manifests (about
> 100 manifests, spread in about 50 modules).
>
> With this patch, I get on an average of 3 run after a blank run:  
> 6.084s
> Without the patch: 6.022s
> So with the patch we're 1.1% slower with the patch.

I'd be interested in the results using a class instead of a hash; I  
expect it'll be a bit slower yet.

>
>> 2) Is it reasonable to just create an instance of a new class here,  
>> or
>> maybe a struct, rather than passing a hash?  The hash is built the
>> same every time (although obviously with different data), which
>> implies it makes sense to use a class.
>
> Yes, you're right, I'll rework this patch.

If it's much slower, it's probably not worth it.  They're all  
ephemeral, so maybe not a biggie.

>
>> It'd be best if we could just return the instance to the parser,
>> rather than [:token, ...], but we'd probably need to find some way to
>> make the token evaluate appropriately for the grammar.
>> That is, it might work to add a 'to_s' method that returns the token
>> string.
>
> Unfortunately I don't think racc will support this, because it
> explecitily wants an array of a Symbol and token object:
> http://i.loveruby.net/en/projects/racc/doc/parser.html

It's probably worth testing.  E.g., we pass symbols but it might work  
equivalently with strings, and if it does, it's using some kind of  
converter method.  All we have to do is implement that converter method.

>
>> The performance thing probably isn't a big deal, but considering the
>> number of lexing tokens in a given configuration, it's at least worth
>> looking at.  It'd be great if someone with a big configuration can
>> give this a try.
>
> Yes, that'd be great.


-- 
No matter how rich you become, how famous or powerful, when you die
the size of your funeral will still pretty much depend on the
weather. -- Michael Pritchard
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to