Skip to content

Performance bottleneck (also for Rapthor) #39

@AlexKurek

Description

@AlexKurek

At the beginning of Rapthors run and when the catalogue is set to LoTTS:

    96215  110.803    0.001  110.803    0.001 {method 'copy' of 'numpy.ndarray' objects}
    13599   32.979    0.002  146.084    0.011 skymodel.py:1020(getRowIndex)
       68    3.832    0.056    3.832    0.056 table.py:1011(getcol)
    16759    2.844    0.000    3.590    0.000 wcs.py:410(__init__)
    81616    2.306    0.000    2.317    0.000 table.py:2226(keys)

In skymodels.py:

Line #      Hits         Time  Per Hit   % Time  Line Contents
  1056      3037    6509104.2   2143.3     29.3%          if self.hasPatches and rowName in self.getPatchNames():                
  1057      3037   15701311.1   5170.0     70.7%              return np.where(self.getColValues('Patch') == rowName)[0].tolist()

If this could be optimised, Rapthor would get a little faster. Method copy of numpy.ndarray is also probably triggered by skymodel.py:1020.

Consider exiting from the function earlier :

if not self.hasPatches:
  return []
if rowName not in self.getPatchNames():
  return []
return np.where(self.getColValues('Patch') == rowName)[0].tolist()

and @lru_cache(maxsize=None) for getPatchNames().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions