Skip to content

Feature: Increase loading performance #62

Description

@JeanLucPons

Description, motivation and use case

The loading time is a bit slow particularly for large lattice.
It mainly comes from the AT element retrieval.

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  8283408    1.464    0.000    2.336    0.000 attribute_linker.py:66(_test_at_element)
     3738    1.423    0.000    3.758    0.001 lattice_elements_linker.py:75(_iter_matches)
  8314133    0.881    0.000    0.881    0.000 {built-in method builtins.getattr}
   390980    0.267    0.000    0.267    0.000 scanner.py:279(stale_possible_simple_keys)
   372861    0.223    0.000    0.526    0.000 scanner.py:145(need_more_tokens)
    23597    0.189    0.000    0.628    0.000 scanner.py:1270(scan_plain)
  ...

Describe alternatives you've considered
Pre-index AT element in a dict. The loading time is reduced by ~30% (EBSOrbit.yaml)

      self._elements_indexing = {}
      for e in self.ring:
        if e.FamName in self._elements_indexing:             
           self._elements_indexing[e.FamName].append(e)
        else:
           self._elements_indexing[e.FamName] = [e]

I let @gupichon to have a look on how to optimize the LatticeElementsLinker.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions