Need a Faster Compressor

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun May 22 12:40:25 PDT 2016


On 5/22/2016 3:32 AM, Era Scarecrow wrote:
> [...]

My idea for speeding things up is every time a new character c is matched in 
pattern[], a bit is set in mask:

     ulong mask;
     ...
     mask |= 1 << (c & 63);

Then, when scanning for longer matches, test:

     if (!((1 << (id[i + matchlen - 1] & 63)) & mask))
	i += matchlen;

because we know that id[i + matchlen - 1] cannot match any of the characters in 
the current match.

The two expressions look complex, but they should compile to single instructions 
on x64.


More information about the Digitalmars-d mailing list