summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freeze/Main.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2005-02-24 17:34:55 +0000
committerMarc Laukien <marc@zeroc.com>2005-02-24 17:34:55 +0000
commite4843a84aee34f87b6ddff1f60f3901fa5d8eed1 (patch)
tree4ee5698a05625634f56085806c1cb59b4960ed13 /cpp/src/slice2freeze/Main.cpp
parentAdded missing break statement (diff)
downloadice-e4843a84aee34f87b6ddff1f60f3901fa5d8eed1.tar.bz2
ice-e4843a84aee34f87b6ddff1f60f3901fa5d8eed1.tar.xz
ice-e4843a84aee34f87b6ddff1f60f3901fa5d8eed1.zip
various performance improvements
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r--cpp/src/slice2freeze/Main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 46f94c52479..4c63ae376b7 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -169,7 +169,7 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, b
{
C << nl << "stream.endWriteEncaps();";
}
- C << nl << "stream.b.copyToVector(bytes);";
+ C << nl << "::std::vector<Ice::Byte>(stream.b.begin(), stream.b.end()).swap(bytes);";
C << eb;
C << sp << nl << "void" << nl << name << "::read(" << typeToString(type) << "& v, "
@@ -181,7 +181,8 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, b
{
C << nl << "stream.sliceObjects(false);";
}
- C << nl << "stream.b.copyFromVector(bytes);";
+ C << nl << "stream.b.resize(bytes.size());";
+ C << nl << "::memcpy(&stream.b[0], &bytes[0], bytes.size());";
C << nl << "stream.i = stream.b.begin();";
if(encaps)
{
@@ -468,7 +469,7 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
{
C << nl << "__stream.writePendingObjects();";
}
- C << nl << "__stream.b.copyToVector(__bytes);";
+ C << nl << "::std::vector<Ice::Byte>(__stream.b.begin(), __stream.b.end()).swap(__bytes);";
}
C << eb;
}
@@ -850,7 +851,7 @@ writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& member
{
C << nl << "__stream.writePendingObjects();";
}
- C << nl << "__stream.b.copyToVector(__bytes);";
+ C << nl << "::std::vector<Ice::Byte>(__stream.b.begin(), __stream.b.end()).swap(__bytes);";
C << eb;
}