From 911a4520ad827c9cd9fb9aca779860398e6570f4 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 14 Apr 2025 17:48:16 -0500 Subject: [PATCH] speed it up a bit more --- src/engine/cmdStreamOps.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/engine/cmdStreamOps.cpp b/src/engine/cmdStreamOps.cpp index 9ae9ccce7..9cb2e8439 100644 --- a/src/engine/cmdStreamOps.cpp +++ b/src/engine/cmdStreamOps.cpp @@ -932,34 +932,24 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector& subBlock // - make sub-blocks!!! logD("testing %d match groups for benefit",(int)origs.size()); size_t origIndex=0; - for (size_t i: origs) { - size_t orig=matches[i].orig; + for (size_t i=0; i testMatches; std::vector testLenMatches; - testMatches.clear(); - if (progress!=NULL) progress->origCurrent=origIndex; origIndex++; - // collect matches with this orig value - for (size_t j=i; jmaxSize) maxSize=matches[j].len; - testMatches.push_back(matches[j]); - } - - //logD("%d: testing %d matches... (lengths %d-%d)",(int)orig,(int)testMatches.size(),minSize,maxSize); + if (!(i&255)) logV("orig %d of %d",(int)i,(int)origs.size()); // test all lengths - for (size_t len=minSize; len<=maxSize; len+=8) { + for (size_t len=minSize; true; len+=8) { testLenMatches.clear(); - assert(!(len&7)); // filter matches - for (BlockMatch& k: testMatches) { + for (size_t _k=begin; _kk.len) continue; @@ -1023,7 +1013,7 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector& subBlock // check whether this set of matches has greater benefit if (finalBenefit>bestBenefit.benefit) { //logD("- %x (%d): %d = %d",(int)i,(int)len,(int)testLenMatches.size(),finalBenefit); - bestBenefit=MatchBenefit(i,finalBenefit,len); + bestBenefit=MatchBenefit(begin,finalBenefit,len); // copy matches so we don't have to select them later workMatches=testLenMatches; }