summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-05-05 13:51:03 -0230
committerDwayne Boone <dwayne@zeroc.com>2009-05-05 13:51:03 -0230
commit9ebcbc1a8af3680fc8512e95bd0fa6a9c67de6e0 (patch)
treede928ddf15ebc8559ad5f3b8e8342a2a28f9dd8c /cpp
parentMinor fix to trace statement (diff)
downloadice-9ebcbc1a8af3680fc8512e95bd0fa6a9c67de6e0.tar.bz2
ice-9ebcbc1a8af3680fc8512e95bd0fa6a9c67de6e0.tar.xz
ice-9ebcbc1a8af3680fc8512e95bd0fa6a9c67de6e0.zip
Bug 1594 - some more byte sequence optimizations
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/Ice/throughput/Client.cpp4
-rw-r--r--cpp/demo/Ice/throughput/README11
-rw-r--r--cpp/demo/Ice/throughput/Throughput.ice4
-rw-r--r--cpp/demo/Ice/throughput/ThroughputI.cpp20
-rw-r--r--cpp/demo/Ice/throughput/ThroughputI.h12
5 files changed, 35 insertions, 16 deletions
diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp
index 9fdd85733f1..c212a76713a 100644
--- a/cpp/demo/Ice/throughput/Client.cpp
+++ b/cpp/demo/Ice/throughput/Client.cpp
@@ -123,7 +123,7 @@ ThroughputClient::run(int argc, char* argv[])
throughput->recvStructSeq();
throughput->recvFixedSeq();
- throughput->echoByteSeq(emptyBytesBuf);
+ throughput->echoByteSeq(emptyBytes);
throughput->echoStringSeq(emptyStrings);
throughput->echoStructSeq(emptyStructs);
throughput->echoFixedSeq(emptyFixed);
@@ -279,7 +279,7 @@ ThroughputClient::run(int argc, char* argv[])
case 'e':
{
- throughput->echoByteSeq(byteSeq);
+ throughput->echoByteSeq(byteArr);
break;
}
}
diff --git a/cpp/demo/Ice/throughput/README b/cpp/demo/Ice/throughput/README
index c6dc9bd0ba9..d4b56c0b205 100644
--- a/cpp/demo/Ice/throughput/README
+++ b/cpp/demo/Ice/throughput/README
@@ -9,3 +9,14 @@ $ server
In a separate window, start the client:
$ client
+
+For the bytes sequence operations in this demo we provide some
+optimizations. For in paramaters we use the "cpp:array" metadata
+which on the server side means that the operation implementation is
+passed pointers into the marshalling buffer which eliminates a copy
+of the sequence data.
+
+For return aramaters we also use the cpp:array" metadata, but this
+time in conjuction with AMD. Doing this also reduces the number of
+times the returned sequence is copied during marshalling.
+
diff --git a/cpp/demo/Ice/throughput/Throughput.ice b/cpp/demo/Ice/throughput/Throughput.ice
index f1c1f0c5418..e6c55b5d2ed 100644
--- a/cpp/demo/Ice/throughput/Throughput.ice
+++ b/cpp/demo/Ice/throughput/Throughput.ice
@@ -43,8 +43,8 @@ interface Throughput
void endWarmup();
void sendByteSeq(["cpp:array"] ByteSeq seq);
- ByteSeq recvByteSeq();
- ByteSeq echoByteSeq(ByteSeq seq);
+ ["amd", "cpp:array"] ByteSeq recvByteSeq();
+ ["amd", "cpp:array"] ByteSeq echoByteSeq(["cpp:array"] ByteSeq seq);
void sendStringSeq(StringSeq seq);
StringSeq recvStringSeq();
diff --git a/cpp/demo/Ice/throughput/ThroughputI.cpp b/cpp/demo/Ice/throughput/ThroughputI.cpp
index a04de0d9472..5865b83d6f7 100644
--- a/cpp/demo/Ice/throughput/ThroughputI.cpp
+++ b/cpp/demo/Ice/throughput/ThroughputI.cpp
@@ -55,23 +55,29 @@ ThroughputI::sendByteSeq(const std::pair<const Ice::Byte*, const Ice::Byte*>&, c
{
}
-Demo::ByteSeq
-ThroughputI::recvByteSeq(const Ice::Current&)
+void
+ThroughputI::recvByteSeq_async(const Demo::AMD_Throughput_recvByteSeqPtr& cb, const Ice::Current&)
{
+ std::pair<const Ice::Byte*, const Ice::Byte*> ret;
if(_warmup)
{
- return Demo::ByteSeq();
+ Demo::ByteSeq empty(1);
+ ret.first = &empty[0];
+ ret.second = ret.first + empty.size();
}
else
{
- return _byteSeq;
+ ret.first = &_byteSeq[0];
+ ret.second = ret.first + _byteSeq.size();
}
+ cb->ice_response(ret);
}
-Demo::ByteSeq
-ThroughputI::echoByteSeq(const Demo::ByteSeq& seq, const Ice::Current&)
+void
+ThroughputI::echoByteSeq_async(const Demo::AMD_Throughput_echoByteSeqPtr& cb,
+ const std::pair<const Ice::Byte*, const Ice::Byte*>& seq, const Ice::Current&)
{
- return seq;
+ cb->ice_response(seq);
}
void
diff --git a/cpp/demo/Ice/throughput/ThroughputI.h b/cpp/demo/Ice/throughput/ThroughputI.h
index 9fb92ed2e48..69e78b87c2d 100644
--- a/cpp/demo/Ice/throughput/ThroughputI.h
+++ b/cpp/demo/Ice/throughput/ThroughputI.h
@@ -21,18 +21,20 @@ public:
virtual bool needsWarmup(const Ice::Current&);
virtual void startWarmup(const Ice::Current&);
virtual void endWarmup(const Ice::Current&);
+
virtual void sendByteSeq(const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
- virtual Demo::ByteSeq recvByteSeq(const Ice::Current&);
- virtual Demo::ByteSeq echoByteSeq(const Demo::ByteSeq& seq, const Ice::Current&);
+ virtual void recvByteSeq_async(const Demo::AMD_Throughput_recvByteSeqPtr&, const Ice::Current&);
+ virtual void echoByteSeq_async(const Demo::AMD_Throughput_echoByteSeqPtr&,
+ const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
virtual void sendStringSeq(const Demo::StringSeq&, const Ice::Current&);
virtual Demo::StringSeq recvStringSeq(const Ice::Current&);
- virtual Demo::StringSeq echoStringSeq(const Demo::StringSeq& seq, const Ice::Current&);
+ virtual Demo::StringSeq echoStringSeq(const Demo::StringSeq&, const Ice::Current&);
virtual void sendStructSeq(const Demo::StringDoubleSeq&, const Ice::Current&);
virtual Demo::StringDoubleSeq recvStructSeq(const Ice::Current&);
- virtual Demo::StringDoubleSeq echoStructSeq(const Demo::StringDoubleSeq& seq, const Ice::Current&);
+ virtual Demo::StringDoubleSeq echoStructSeq(const Demo::StringDoubleSeq&, const Ice::Current&);
virtual void sendFixedSeq(const Demo::FixedSeq&, const Ice::Current&);
virtual Demo::FixedSeq recvFixedSeq(const Ice::Current&);
- virtual Demo::FixedSeq echoFixedSeq(const Demo::FixedSeq& seq, const Ice::Current&);
+ virtual Demo::FixedSeq echoFixedSeq(const Demo::FixedSeq&, const Ice::Current&);
virtual void shutdown(const Ice::Current& c);
private: