fmgoncalves/p5-cassandra-simple — Issue #1: wish: Consider use thrift-xs
Author: jcbf
Created: 2011-12-31 15:59:20+00:00
State: open

Andy Grundman's Thrift-XS is a drop-in replacement for Thrift module.

*Thrift::XS provides faster versions of Thrift::BinaryProtocol and Thrift::MemoryBuffer.
Thrift compact protocol support is also available, just replace Thrift::XS::BinaryProtocol with Thrift::XS::CompactProtocol.
To use, simply replace your Thrift initialization code with the appropriate Thrift::XS version.*

Check please http://search.cpan.org/~agrundma/Thrift-XS-1.04/ or https://github.com/andygrundman/thrift-xs
Could do something similar with [JSON module](http://search.cpan.org/~makamaka/JSON-2.53/lib/JSON.pm) and allow the developer to specify with backend or load XS and fallback to PurePerl

Benchmarks shows significant improvment

XS::MemoryBuffer write + read: 6x faster

XS::BinaryProtocol
writeMessageBegin + readMessageBegin: 12.0x
complex struct/field write+read: 6.6x
writeMapBegin + readMapBegin: 24.0x
writeListBegin + readListBegin: 20.0x
writeSetBegin + readSetBegin: 21.0x
writeBool + readBool: 13.5x
writeByte + readByte: 13.9x
writeI16 + readI16: 14.4x
writeI32 + readI32: 12.9x
writeI64 + readI64: 29.4x
writeDouble + readDouble: 13.5x
writeString + readString: 7.5x

XS::CompactProtocol
writeMessageBegin + readMessageBegin: 11.6x
complex struct/field write+read: 6.2x
writeMapBegin + readMapBegin: 18.7x
writeListBegin + readListBegin: 14.1x
writeSetBegin + readSetBegin: 13.3x
writeBool + readBool: 13.2x
writeByte + readByte: 13.9x
writeI16 + readI16: 9.0x
writeI32 + readI32: 7.5x
writeI64 + readI64: 10.0x
writeDouble + readDouble: 13.5x
writeString + readString: 7.4x