THRIFT-1189. rb: Ruby deserializer speed improvements
This patch gives the Ruby deserialization stack a healthy performance boost.
Patch: Ilya Maykov
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1140780 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/binary_protocol_spec.rb b/lib/rb/spec/binary_protocol_spec.rb
index 0abccb8..6da467e 100644
--- a/lib/rb/spec/binary_protocol_spec.rb
+++ b/lib/rb/spec/binary_protocol_spec.rb
@@ -31,10 +31,8 @@
end
it "should read a message header" do
- @trans.should_receive(:read_all).exactly(2).times.and_return(
- [protocol_class.const_get(:VERSION_1) | Thrift::MessageTypes::REPLY].pack('N'),
- [42].pack('N')
- )
+ @trans.write([protocol_class.const_get(:VERSION_1) | Thrift::MessageTypes::REPLY].pack('N'))
+ @trans.write([42].pack('N'))
@prot.should_receive(:read_string).and_return('testMessage')
@prot.read_message_begin.should == ['testMessage', Thrift::MessageTypes::REPLY, 42]
end