Make EquatorialToHorizontal faster by a number of improvements
1. Cache trigonometric values for RA, Dec and RA0, Dec0
Warning: This might negatively affect performance of
updateCoords(), which is another MAJOR bottleneck in KStars
2. Avoid calling sincos() on HourAngle -- instead just compute it
using CachingDms subtraction operator.
3. Avoid cos( AltRad ) computation. Instead use cos x = sqrt(1 -
sin(x)^2)
The result is an improvement of EquatorialToHorizontal() average
run-time from ~ 567 ns to ~ 341 ns per call. Note: I would have
expected a more significant improvement, but it might be improved once
we remove profiling instrumentation from dms and CachingDms.
Profiling did not reveal a significant advantage here mostly because
of the updateCoords() short-circuit in
StarObject::JITUpdate(). However, I presume that the impact will be
significant when slewing / zooming -- operations that are very hard to
profile, and time steps of > 1 minute, which we will have to
unfortunately address only later.
Change LST and latitude to CachingDms -- this saves a lot of trig calls!
Test case:
==========
Simulation clock running at 1s per step, centered around USNO NOMAD
milky way artifact patch at the center of milky way, specifically on
Globular Cluster NGC 6569 at Zoom Factor of 32000. Using Horizontal
Coordinates. Projection = 3.
Results:
========
Before:
-------
For the USNO NOMAD catalog under these conditions,
DeepStarComponent::draw spent ~ 0.25s doing ~2233550 trigonometric
function calls per draw ( presumably without updateCoords() being
called -- we call updateCoords only if there's a time slew of more
than 1 solar minute; see StarObject::JITUpdate() )
After:
------
After the change, DSC::draw() spent only ~ 0.18s doing only ~1489260
trigonometric function calls.
Note: A call to sincos() is considered to be 2 trigonometric calls.