|
From: Renk T. <tho...@jy...> - 2013-04-15 06:12:28
|
> If you just want a quick and dirty way to read one property, we have > getprop / setprop - for any other use, you should be doing what the API > already supported; getting a props.Node object for the leaf, and then > manipulating it with no further string/path handling. > Using getprop on the one hand does not allow getting a property > converted to a given type and on the other hand is tedious to use for > more than one property, as one has to assemble the according property > paths (which is definitely less efficient than using a relative method). If there is even a slight performance concern, the only justification I ever see for not using getprop() / setprop() is if you explicitly require to set a variable type. Assembling a property path by string manipulation may be in theory less appealing, but it is in practice 3 to 10 times faster than using the props module - I have made several benchmark tests, all leading to the same result. Large-scale property manipulation from Nasal is performance hungry and should be avoided if possible by using Nasal-internal variables instead, and if it needs to be done, getprop() /setprop() offer significantly superior performance. If you dig a bit in the mailing list archive, there should be a post with the actual benchmark test results. * Thorsten |