Ticket #45123

Optimize action_by_number()

Eröffnet am: 2022-07-17 15:31 Letztes Update: 2022-08-05 09:05

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
2

Details

Profiling run showed that now action_by_number() is a major performance bottleneck (took over 10% of the run time).

In addition to the function call overhead, it does work that's redundant for most callers: it's called A LOT inside action_iterate(). The action_iterate() iterates over valid actions only, so no point to do all that checking of action validity in those action_by_number() calls.

There's several ways we could rework this. One is to inline the function, trusting that the compiler then detects what's redundant in each call, and optimizes. In a quick test with inlined action_by_number(), there was a huge improvement in the total run time of an autogame.

Ticket-Verlauf (3/6 Historien)

2022-07-17 15:31 Aktualisiert von: cazfi
  • New Ticket "Optimize action_by_number()" created
2022-07-17 16:02 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
  • Meilenstein Update from (Keine) to 3.0.3 (closed)
2022-07-24 20:54 Aktualisiert von: cazfi
Kommentar

3.0.3 release is coming sooner than earlier expected -> don't want to take unnecessary risks of regressions (with the limited time that this would be tested in branch).

2022-08-05 09:05 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Dateianhangliste

Bearbeiten

Please login to add comment to this ticket » Anmelden