Nasal for C++ programmers: Difference between revisions

Jump to navigation Jump to search
m
Line 270: Line 270:


=== Shouldn't we favor C++ over Nasal? ===
=== Shouldn't we favor C++ over Nasal? ===
{{FGCquote
  | if you have a task that consumes 0.01% of the total computational performance, it doesn't matter whether you do it efficient [C++/GLSL] or inefficient [Nasal] - if you make it ten times faster, the framerate won't move a bit, and if you make it a hundred times slower, the framerate won't move either. Given that, you can priorize accessibility and ease of maintenance over execution speed.
(To give you a sense of perspective - the typical Nasal subsystem runs a couple of hundred lines per frame. Rendering at high quality runs about 1500 lines for each of your two million pixels every frame and loops over an array containing a good million vertices). That's about a factor of thirty million more operations per unit time. So FG doesn't lean 'heavy' on Nasal in terms of where the work is.
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=232079#p232079
    |title=<nowiki>Re: Sometime, with Yasim... frame-rate is slow</nowiki>
    |author=<nowiki>Thorsten</nowiki>
    |date=<nowiki>Sat Feb 14</nowiki>
  }}
}}
Performance-critical code should definitely be implemented in C++ space. Still, there are several options, such as dedicated C++ subsystems (SGSubsystem) or Nasal extension functions.
Performance-critical code should definitely be implemented in C++ space. Still, there are several options, such as dedicated C++ subsystems (SGSubsystem) or Nasal extension functions.


Navigation menu