How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
Line 21: Line 21:
The current Nasal garbage collector (GC) is known to affect the frame rate in FlightGear and occasionally causes stutter (increased frame spacing) under certain circumstances (i.e. under heavy load, due to complex scripts - such as the [[Bombable]] addon or the local weather system.  
The current Nasal garbage collector (GC) is known to affect the frame rate in FlightGear and occasionally causes stutter (increased frame spacing) under certain circumstances (i.e. under heavy load, due to complex scripts - such as the [[Bombable]] addon or the local weather system.  


This is largely attributed to the GC being a fairly simple sequential [http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Copying_vs._mark-and-sweep_vs._mark-and-don.27t-sweep mark/sweep collector], which needs to stop all operations, mark all reachable objects and free unreachable objects in an exclusive, single-threaded, fashion.
This is largely attributed to the GC being a fairly simple sequential [http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Copying_vs._mark-and-sweep_vs._mark-and-don.27t-sweep mark/sweep collector], which needs to stop all operations, recursively mark all reachable objects and free unreachable objects in an exclusive, single-threaded, fashion.


In other words, the time spent in the GC is proportial to the number of active objects (i.e.  lines of code), even for objects which may not be running or active - just loaded. For additional background information, please see [[Improving Nasal]].
In other words, the time spent in the GC is proportial to the number of active objects and references held (i.e.  lines of code), even for objects which may not be running or active - just loaded. For additional background information, please see [[Improving Nasal]].


{{cquote|allocating objects into generations and only mark/reaping from the most recent one on most iterations is a straightforward optimization and will definitely make things faster.| (Andy Ross) FlightGear Devel mailing list<ref>{{cite web |url=http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg37385.html |title=Nasal performance |author=Andy Ross |date=22 May 2012 }}</ref>}}
{{cquote|allocating objects into generations and only mark/reaping from the most recent one on most iterations is a straightforward optimization and will definitely make things faster.| (Andy Ross) FlightGear Devel mailing list<ref>{{cite web |url=http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg37385.html |title=Nasal performance |author=Andy Ross |date=22 May 2012 }}</ref>}}

Navigation menu