From 4ae082bfc7a816d6212837a9080e1421547492ba Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 10:35:56 +0200 Subject: [PATCH] avoid allocating strings all the time. --- utils/bench-packets.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index 29c1044e4..e16c17b02 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -35,7 +35,7 @@ public: static uint32_t GetUid (void); - std::string GetName (void) const; + static std::string GetName (void); void Print (std::ostream &os) const; uint32_t GetSerializedSize (void) const; void Serialize (Buffer::Iterator start) const; @@ -60,18 +60,16 @@ template uint32_t BenchHeader::GetUid (void) { - std::ostringstream oss; - oss << "BenchHeader" << N; - static uint32_t uid = AllocateUid > (oss.str ()); + static uint32_t uid = AllocateUid > (GetName ()); return uid; } template std::string -BenchHeader::GetName (void) const +BenchHeader::GetName (void) { std::ostringstream oss; - oss << N; + oss << "BenchHeader" << N; return oss.str (); }