Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2725 closed enhancement (invalid)

[PATCH] Long range pathfinder performance improvements in AtGoal()

Reported by: kanetaka Owned by: kanetaka
Priority: Should Have Milestone:
Component: Core engine Keywords: patch
Cc: Patch:

Description

The original AtGoal() calculates the distance to goal every time, but the distance can be got from heuristic cost. This routine is in main loop on CCmpPathfinder::ComputePath(), it requires optimization. To check my improvements, I added some profiling code in both the original and my patch and I have both codes run with replay mode. The commands.txt is from 1 human vs. 1 AI player's match. The result is:

HRT: using name=TSC freq=1796000000.P000000
HRT: counter=TSC freq=1.796e+009 res=5.56793e-010 bits=64

Original
  tc_AtGoal: 431.391 Mc (788205x)
My patch
  tc_AtGoal: 67.5181 Mc (788205x)

The numbers of called are same, which implies this patch doesn't change pathfinding results. The performance improvements about 7 times faster.

Attachments (2)

AtGoal.patch (2.0 KB ) - added by kanetaka 10 years ago.
commands.txt (94.5 KB ) - added by kanetaka 10 years ago.

Download all attachments as: .zip

Change History (6)

by kanetaka, 10 years ago

Attachment: AtGoal.patch added

by kanetaka, 10 years ago

Attachment: commands.txt added

comment:1 by Stan, 10 years ago

That's awesome, keep up the good work :) Do you think a 7time faster calculation would save up a lot of lag ?

in reply to:  1 comment:2 by Niek, 10 years ago

Replying to stanislas69:

That's awesome, keep up the good work :) Do you think a 7time faster calculation would save up a lot of lag ?

As kanetaka wanted to say (but got rejected): No, 300 Mc gain is only 1/6 seconds per game. It might differ per game, but I'm not sure. Although I do not completely understand how the engine works, I guess the other components are the bottlenecks.

Last edited 10 years ago by Niek (previous) (diff)

comment:3 by leper, 10 years ago

Keywords: review removed
Resolution: invalid
Status: newclosed

Uses floats in simulation code (breaks network sync). Also the pathfinder is in the process of being rewritten (as bad algorithms can't be fixed with micro-optimizations; and the current pathfinders have mismatches (which is the reason it is being rewritten)). It'd be nice if you'd help with the new wip pathfinder.

comment:4 by Itms, 10 years ago

Milestone: Alpha 17
Note: See TracTickets for help on using tickets.