20,741
edits
Line 55: | Line 55: | ||
}}</ref> | }}</ref> | ||
here is a fair degree of property I/O taking place here behind the scenes - keep in mind that you are typically setting hundreds, if not even thousands, of properties before you end up with a Canvas/Element representation of the corresponding SVG/XML "object". | |||
You can basically wrap the call in between two systime() calls or use debug.benchmark(func() {YOUR CODE HERE}); | |||
When you do that with the BUILT-IN PROFILER (wiki) enabled/running, you will undoubtedly see tons of property and Nasal overhead. | |||
That is the reason why we ended up introducing the SymbolCache framework for elements that are "semi-static", i.e. that mainly differ in terms of transformation, color, label etc - i.e. style-able attributes. | |||
The ND rendering hundreds of symbols would otherwise also have the same I/O overhead due to all the Nasal and property tree "context switches". | |||
What worked fairly well was identifying the bottleneck (we used the profiler for that) and then we moved /some/ helpers to C++ space.<ref>{{cite web | |||
|url = https://forum.flightgear.org/viewtopic.php?p=283452#p283452 | |||
|title = <nowiki> Re: Best way to learn Canvas? </nowiki> | |||
|author = <nowiki> Hooray </nowiki> | |||
|date = Apr 25th, 2016 | |||
|added = Apr 25th, 2016 | |||
|script_version = 0.40 | |||
}}</ref> | |||