Incidencia #45123

Optimize action_by_number()

Abrir Fecha: 2022-07-17 15:31 Última actualización: 2022-08-05 09:05

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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 History (3/6 Histories)

2022-07-17 15:31 Updated by: cazfi
  • New Ticket "Optimize action_by_number()" created
2022-07-17 16:02 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
  • Hito Update from (Ninguno) to 3.0.3 (cerrado)
2022-07-24 20:54 Updated by: cazfi
Comentario

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 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Attachment File List

Editar

Please login to add comment to this ticket » Entrar