Am 2013-04-15 08:12, schrieb Renk Thorsten: >> 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.
I've found a topic in the forum [1]. I've now also done some benchmarks and got very varying results. setprop is nearly always the fastest, but not always, sometimes getValue (with a relative path) can be slower. But setprop was a maximum of ~2 times faster than the other methods. I'll investigate this further to see where the time is lost. Probably somewhere while creating Nasal objects. Maybe with directly using a ghost for property nodes it will get faster. Also the methods with relative paths and set/getprop use exactly the same code on the C++ side, so the performance is lost somewhere between the props.nas module and the C++/Nasal bindings. [1] http://www.flightgear.org/forums/viewtopic.php?f=30&t=9493 -- Thomas Geymayer www.tomprogs.at / C-Forum und Tutorial: www.proggen.org ------------------------------------------------------------------------ Student of Computer Science @ Graz University of Technology ------------------------------- Austria -------------------------------- ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel