Skip to content

Commit

Permalink
[fix][performance] Disable vmsplice because it generates wrong results
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlnkn committed Apr 22, 2024
1 parent 11fb22b commit de39239
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/core/FileUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,25 @@
#include <sys/uio.h>
#include <unistd.h>

#if not defined( HAVE_VMSPLICE ) and defined( __linux__ ) and defined( F_GETPIPE_SZ )
#define HAVE_VMSPLICE
#endif
//#if not defined( HAVE_VMSPLICE ) and defined( __linux__ ) and defined( F_GETPIPE_SZ )
// #define HAVE_VMSPLICE
//#endif

#if not defined( HAVE_IOVEC ) and defined( __linux__ )
#define HAVE_IOVEC
#endif
#endif

/**
* Disable vmsplice because it STILL has bugs. In this case it seems to happen because rapidgzip quits
* before everything has been read. This seems to cause a free and possible reuse of the memory section
* during the shutdown process and causes invalid output. I guess the only real way to get this to work
* is as stated below with a custom mmap allocator + vmsplice gift.
* Too bad, because it gave quite some performance, but it's no use when the results are wrong.
* https://github.com/mxmlnkn/rapidgzip/issues/39
*/
#undef HAVE_VMSPLICE


#if defined( HAVE_VMSPLICE )
#include <any>
Expand Down
1 change: 0 additions & 1 deletion src/rapidgzip/ChunkData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ writeAll( const std::shared_ptr<ChunkData>& chunkData,
#else
using rapidgzip::deflate::DecodedData;

bool splicable = true;
for ( auto it = DecodedData::Iterator( *chunkData, offsetInBlock, dataToWriteSize );
static_cast<bool>( it ); ++it )
{
Expand Down

0 comments on commit de39239

Please sign in to comment.