Repository navigation
Open
Description
DataProcessing/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Lines 180 to 182 in f86fadc
| std::string Waypoint::root_at_label() | |
| { return route->root + "@" + label; | |
| } |
->
std::string Waypoint::root_at_label()
{ return route->root + '@' + label;
} - ...should in theory be more efficient.
- Disassembling with
objdump, I see only thechar*+ operator.
...But thecharoperator could just be inlined by the compiler. - Some inlining does appear to be happening, as
sort_root_at_labelandnmplogsalso change.
BiggaTomato
| function | lines | bytes |
|---|---|---|
| sort_root_at_label | -75 | -288 |
| root_at_label | 41 | 160 |
| nmplogs | -96 | -352 |
Counterintuitively, root_at_label gets bigger. Go figure.
TBD: Is this the case on other machines?
The damage from this should be minimized, though:
nmplogshas...- 2 calls to
sort_root_at_label(the 2nd is within a loop) - 2 calls to
root_at_label, but called half the time per the result of (looped)sort_root_at_label
For simplicity we can call this the equivalent of 1 unconditional call. sort_root_at_labelhas bigger deltas, so the time savings here probably outweigh the slowdown.*
- 2 calls to
- The only other uses of bare (outside the sort function)
root_at_labelare in flagging detected datacheck errors inHighwaySystem::route_integrity, and should thus be quite rare:- 2 flavors of DISCONNECTED_ROUTE
- 2 flavors of VISIBLE_HIDDEN_COLOC (still in-dev right now, but expected to be committed Real Soon Now)
sort_root_at_labelis otherwise used inWaypointQuadtree::sort(), which should get faster.
*Maybe. This is an assumption; the true results depend on how many clock cycles the underlying instructions take. That's farther into the weeds than I wanna go, LOL.
Activity