Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3712 closed defect (fixed)

Optimization of the isBoxVisible function

Reported by: mimo Owned by: mimo
Priority: Should Have Milestone: Alpha 20
Component: Core engine Keywords: patch
Cc: Patch:

Description

The unit renderer calls a lot the function isBoxVisible to know if the bounding box of a unit is visible. On a visual replay with 2000 turns, there are about 4.6M such calls. The attach patch optimizes it, mainly inlining some functions. But in addition, this function allows to have a shifted box, but is always called with (0,0,0), while several Vector3D creations per call are needed to take the possible shift into account. So I've added an overloaded function without this shift. Running valgrind on the visual replay with 2000 turns, the time spent in this function goes from 0.8% (with 0.5% internal) of the total replay time to 0.4% (all internal), so a factor 2 decrease.

Attachments (1)

ticket3712.patch (13.2 KB ) - added by mimo 8 years ago.

Download all attachments as: .zip

Change History (3)

by mimo, 8 years ago

Attachment: ticket3712.patch added

comment:1 by mimo, 8 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 17561:

Optimization of isBoxVisible + cleanup, fixes #3712

comment:2 by mimo, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.