待辦事項 #45123

Optimize action_by_number()

啟用日期: 2022-07-17 15:31 最後更新: 2022-08-05 09:05

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

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
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
  • 里程碑 Update from (無) to 3.0.3 (closed)
2022-07-24 20:54 Updated by: cazfi
評語

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
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

Attachment File List

編輯

Please login to add comment to this ticket » 登入