#3541 closed enhancement (fixed)
[PATCH] Optimize TestRayAASquare in Geometry.cpp
| Reported by: | Stan | Owned by: | Stan |
|---|---|---|---|
| Priority: | Nice to Have | Milestone: | Alpha 20 |
| Component: | Core engine | Keywords: | patch |
| Cc: | Patch: |
Description
There is a todo line 244 of Geometry.cpp that says :
// Exactly like TestRaySquare with u=(1,0), v=(0,1) // Assume the compiler is clever enough to inline and simplify all this // (TODO: stop assuming that)
Attachments (8)
Change History (14)
by , 9 years ago
comment:1 by , 9 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
by , 9 years ago
| Attachment: | 3451.2.diff added |
|---|
Replace some scalar computations by the value to save some computations, add doxygen documentation, and rename some variables to make the code more readable.
comment:2 by , 9 years ago
| Keywords: | pathfinding added |
|---|---|
| Summary: | [PATCH] Remove Redundant Code in geometry.cpp → [PATCH] Optimize TestRayAASquare in Geometry.cpp |
Yeah, that's the right direction in my understanding.
- It would be better though to not rename variables, as they have the same name in the other code as well and the patch will be easier to review.
- Remove the
au, av, bu, bvvariables, as you can just referenceu.Xetc..
- The goal is to completely remove the constants
u, v. So theu.Multiply(hw)things also need to be simplified / consolidated.
Those vector functions are defined in FixedVector2D.h and reflect the usual vector operations known from linear algebra.
by , 9 years ago
| Attachment: | 3451.3.diff added |
|---|
Assert the previous comments, though we cannot remove u and v for now.
comment:3 by , 9 years ago
Here are the maths behind the changes as you can see there is not much to be done for s1,s3
S0 (1;0) * X + (0;1) * Y - (B;C) = (X;Y) - (B;C) = (X-B;Y-C) = (Halfsize - a) S1 (1;0) * X - (0;1) * Y - (B;C) = (X; - Y) - (B;C) = (X-B;-Y-C) S2 - (1;0) * X - (0;1) * Y - (B;C) = -(X;Y) - (B;C) = (-X-B;-Y-C) = (-Halfsize - a) S3 - (1;0) * X + (0;1) * Y - (B;C) = (-X;Y) - (B;C) = (-X-B;Y-C) (X;Y)-(0,2Y) (X;Y) = (X;-Y)
by , 9 years ago
| Attachment: | t3451_optimize_TestRayAASquare_v4.patch added |
|---|
comment:4 by , 9 years ago
| Milestone: | Backlog → Alpha 20 |
|---|---|
| Priority: | Should Have → Nice to Have |
by , 9 years ago
| Attachment: | profile.7z added |
|---|
An alpha 19 replay and it's profiling data showing the performance details. The match was a 40min 3v3 with 200 pop capacity and too many trees.
by , 9 years ago
| Attachment: | profile.jpg added |
|---|
comment:6 by , 9 years ago
| Cc: | removed |
|---|---|
| Keywords: | pathfinding review removed |
| Type: | defect → enhancement |


Fix the Todo.