待辦事項 #42883

advance_index_iterate(): Move advance_count() call outside the loop

啟用日期: 2021-09-19 21:28 最後更新: 2021-09-30 19:50

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

細節

advance_index_iterate() terminates when index variable reaches advance_count(). The advance_count() is called for the check each and every round of the iteration. That's a lot of unnecessary function call overhead. We should call it just once, outside the loop, and place the result in a variable to use inside the loop.

There's currently gcc-12 trouble with advance_index_iterate() involved. Maybe we should wait that to get resolved first, though I think it's a compiler, not freeciv, bug. ( Filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102405 )

Ticket History (3/5 Histories)

2021-09-19 21:28 Updated by: cazfi
  • New Ticket "advance_index_iterate(): Move advance_count() call outside the loop" created
2021-09-20 06:53 Updated by: cazfi
評語

Reply To cazfi

There's currently gcc-12 trouble with advance_index_iterate() involved. Maybe we should wait that to get resolved first, though I think it's a compiler, not freeciv, bug.

Gcc considered it not-a-bug, so we have to handle that ourselves -> #42885

2021-09-23 11:52 Updated by: cazfi
  • 處理結果 Update from to Accepted
  • 里程碑 Update from (無) to 2.6.6 (closed)
2021-09-30 19:50 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from Accepted to 修正

編輯

Please login to add comment to this ticket » 登入