C++ portable array serialization -
on project work on, have send arrays of float / double , forth on network, i'm using boost.asio network stuff, need communication async, , seemed best (the real one?) out there...
the arrays sent floats / doubles, , type known both sides. afaik, there possible problems floating point storage standards + same stuff goes on longs/ints, endians etc.
logically, arrays sent dense matrices, handled eigen on 1 end, using blas / [mkl|atlas] , whatnot on other end, quite possible other uses needed, i'm going generic way possible & seems passing around arrays.
the key requirement high performance , portability, both client , server possibly run on combination of 32 / 64 bit , communication pretty intense (real-time monitoring, refreshes every-something-seconds client), serialization overhead has minimal.
from have found far, 2 big players consider here boost.serialization , google's protobuf.
the big pro bs use boost quite alot in project (though unit testing in google test) , seems simple serialize array using make_array()
. big con performance.
the advantage protobuf found performance, benches seem show outperforms bs factor of 10-20 on operation. didn't find in protobuf docs though adding array message. uses repeated fields, , understand, i'd have use msgobject.repeatedprop.add(const t&)
on each element of array, mean, i.e., 10k calls 10k array, , seems kindof costly too.
any suggestions on how tackle highly appreciated, experience c++ limited , i've restarted writing in after longer break...
in addition boost asio, might want @ boost.mpi (message passing interface). uses boost.serialization serialization behind scenes.
boost.mpi discusses performance optimisations possible booost.serialization. in particular, use of
- boost_class_tracking(gps_position,track_never)
- boost_class_implementation(gps_position,object_serializable)
macros, , mpi-defined macro
- boost_is_mpi_datatype(gps_position)
these optimisations seem work well, see this graph.
i have never used protobuff can't speak this.
Comments
Post a Comment