12/28/2023 0 Comments The Foundry Katana 6.0v3 free![]() Running the above example as part of a large Katana scene file reduced the scene processing time of this function by approximately 2.5x as shown in the following table:Ĭonsider creating custom C++ Ops to replace costly OpScripts The preceding code can be re-written to handle all concatenation only once the loop has completed as shown below: Whilst convenient, this results in a large number of string allocations and poor performance. Note:For more information see .Īs a concrete example of Understand the Lua Garbage Collector, in this recommendation we explore the use of the string concatenation operator “.”, commonly used in OpScripts due to its convenient shorthand notation.Īs an example, consider the following code used to build an L-System description: If this executed within a loop of n iterations it results in the creation of n closures. end - Executing a function statement creates a closure. - Each time a table constructor is executed, a new table is created. ![]() As Lua strings are unique it firstly checks to determine if the string has been created elsewhere. String_one.string_two - String concatenation or any string creation function could potentially result in the creation of a new object.You should pay particular attention it these constructs are used within loops. The following Lua constructs, while not bad, result in a new object being created which must be subsequently cleaned up during garbage collection. When the garbage collector is running your Lua code cannot make forward progress therefore, reducing the frequency with which the garbage collector must run or, the amount of garbage it must collect, helps to improve the performance of your OpScripts. Objects or memory allocated on the heap is reclaimed through Lua’s garbage collector. In Lua, memory can be allocated on either the stack or the heap. Improving OpScript Performance Understand the Lua Garbage Collector ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |