Re: [Vala] Help me find the right Vala idiom



On 06Mar12, Chris Elston allegedly wrote:
Thanks to both Mark and Andrea for taking the time to look at this for
me.

Mark's solution is good because it looks to me like pretty clean OO
without using GObject introspection. I'm not sure on the cost of
wrapping each fundamental type in a parse class though. How much memory
does each of those wrapping class instances take up when my config class
might have hundreds of them?

A good way to find that out is to use -C with valac to see the C code
generated. A brief look suggests that each class instance is pretty
small. Even with hundreds of entries I'd be surprised if you burn more
than a couple of K of memory.

The other thing is that the parse table only has to exist while
parsing, if you transfer the parsed values to some other structure and
have the parse table as a local variable in the parser code, then it
will be destroyed and returned to the memory pool.

and about half as fast as the C (for 100 iterations).
Although Andrea's solution is also doing more error checking

Since vala generates C, it can be as fast, but for a one-time config
parse, is this significant in the scheme of the whole program?


Mark.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]