Lisp HUG Maillist Archive

Advice on bit-vector optimisation needed

Hello lispworkers,

I am going to exploit bit vectors basing on the code like this:

(defun bit-vector-zerop (bit-vector)
  (declare (optimize (speed 3) (safety 0)))
  (every #'zerop bit-vector))

(defun bit-vector-test (x y)
  (not (bit-vector-zerop (bit-and x y))))  ; a la logtest

Has anybody made benchmark tests on bit-vector operations bit-and and the
like?
Are the operations on bignums implemented more effective in LispWorks?
Please advise.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Re: Advice on bit-vector optimisation needed

Unable to parse email body. Email id is 8620

Re: Advice on bit-vector optimisation needed

Dmitriy Ivanov writes:
> I hope that 
>     (not (zerop (sbit bit-vector i)))

      (plusp (sbit bit-vector i)) ; (or (zerop bit) (plusp bit))

> is as fast as 
>     (logtest bignum (ash 1 i)).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

CONSUMER NOTICE: Because of the "uncertainty principle," it is
impossible for the consumer to simultaneously know both the precise
location and velocity of this product.


Updated at: 2020-12-10 08:42 UTC