[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orekit Developers] SolidTides Performance


I noticed 7dd5403 made a big improvement (2x!) in performance of
SolidTides. Since the class was also made thread safe I quickly checked
its performance with multiple threads using it at the same time. For
evaluating the tides field in SolidTidesTest 100000 times I got these

single thread   1.3 s
many threads   72   s

I think the big slow down with many threads comes from the layer of
caching and locking implemented in TidesField. If concurrent performance
is important for SolidTides then one solution is to eliminate contention
for that cache by letting the user handle it explicitly. Something like:

interface HarmonicsProvider {

    Harmonics onDate(AbsoluteDate date);


interface Harmonics {

    double getSnm(int n, int m);
    double getCnm(int n, int m);


Constant Providers could return the same immutable Harmonics each time,
while time dependent providers could return a new object with the
precomputed coefficients for that date. Its use would look like:

HarmonicsProvider provider = ...;
//precompute coefficients for given date
Harmonics harmonics = provider.onDate(date);
//use in evaluation loop
double cnm = harmonics.getCnm(m,n);

Explicit in these interfaces is the assumption that if the user wants
one coefficient on a particular date then the user will want all
coefficients on that date. TidesField would still have to use a TSC for
the interpolation points, but no caching/locking would be needed for the
evaluation points.

What do you think? I'm open to other ideas too. :)

Best Regards,