mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r17840) -Codechange: use the new pool's concepts (caching + not zeroing). Improves average CargoPacket con/destruction time by ~20%, MoveTo/Append by 5-10% and application performance by up to 2%.
This commit is contained in:
parent
1528b64a68
commit
547677a782
|
@ -32,11 +32,16 @@ CargoPacket::CargoPacket()
|
||||||
this->source_id = INVALID_SOURCE;
|
this->source_id = INVALID_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NOTE: We have to zero memory ourselves here because we are using a 'new'
|
||||||
|
* that, in contrary to all other pools, does not memset to 0. */
|
||||||
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) :
|
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) :
|
||||||
|
feeder_share(0),
|
||||||
count(count),
|
count(count),
|
||||||
|
days_in_transit(0),
|
||||||
source_id(source_id),
|
source_id(source_id),
|
||||||
source(source),
|
source(source),
|
||||||
source_xy(source_xy)
|
source_xy(source_xy),
|
||||||
|
loaded_at_xy(0)
|
||||||
{
|
{
|
||||||
assert(count != 0);
|
assert(count != 0);
|
||||||
this->source_type = source_type;
|
this->source_type = source_type;
|
||||||
|
|
|
@ -25,7 +25,7 @@ typedef uint32 CargoPacketID;
|
||||||
struct CargoPacket;
|
struct CargoPacket;
|
||||||
|
|
||||||
/** Type of the pool for cargo packets. */
|
/** Type of the pool for cargo packets. */
|
||||||
typedef Pool<CargoPacket, CargoPacketID, 1024, 1048576> CargoPacketPool;
|
typedef Pool<CargoPacket, CargoPacketID, 1024, 1048576, true, false> CargoPacketPool;
|
||||||
/** The actual pool with cargo packets */
|
/** The actual pool with cargo packets */
|
||||||
extern CargoPacketPool _cargopacket_pool;
|
extern CargoPacketPool _cargopacket_pool;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue