[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A little compression...



On May 25, 6:41 am, Harry Potter <maspethro...@aol.com> wrote:
> On May 25, 4:21 am, Dombo <do...@disposable.invalid> wrote:
>
> > Instead of using array indexes in the for loop, you might
> > consider using pointer arithmetic, whether you gain anything will depend
> > on the compiler (untested code):
>
> I did.  But I'll try your method.
>
Little or no noticeable improvement.

> > You could also consider comparing 32 bit values at a time, and if the
> > 32-bit values are unequal figure out which byte is not equal.
>
> Okay.
>
Again, little or no noticeable improvement.

> > However comparing multiple
> > bytes at a time does make the code quite a bit more complex.
>
> Understood.
>
Same.

I also tried optimizing ByteRef::ChkBlock() with assembler, with
little or no noticeable improvement.  The assembler follows (386):

		push	esi
		push	edi
		mov	ebx,in2
		mov	esi,ebx
		add	esi,Cur
		mov	edi,ebx
		add	edi,Prev
		xor	ecx,ecx
comp:
		cmpsb
		jne	notequ
		inc	ecx
		cmp	ecx,j
		jb	comp
notequ:
		cmp	ecx,3
		jae	ex
		xor	ecx,ecx
ex:
		mov	i,ecx
		pop	edi
		pop	esi