From 0891424610ff1f4f9afe89d0a0518c6db3efd099 Mon Sep 17 00:00:00 2001 From: flashk Date: Wed, 3 Oct 2018 14:12:54 -0700 Subject: [PATCH] osgDB::OutputStream write array optimization I've made a change to osgDB::OutputStream::writeArrayImplementation so that it writes the array data in a single write operation for binary files. This significantly speeds up writing out osgb files for large data sets (e.g. point clouds). osgDB::InputStream already performs a similar optimization when reading array data from binary files. --- src/osgDB/OutputStream.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/osgDB/OutputStream.cpp b/src/osgDB/OutputStream.cpp index c5a385f81..8d8a7abe5 100644 --- a/src/osgDB/OutputStream.cpp +++ b/src/osgDB/OutputStream.cpp @@ -925,24 +925,31 @@ template void OutputStream::writeArrayImplementation( const T* a, int write_size, unsigned int numInRow ) { *this << write_size << BEGIN_BRACKET; - if ( numInRow>1 ) + if ( isBinary() ) { - for ( int i=0; i1 ) + { + for ( int i=0; i