Re: [Scheme-reports] Bitwise operations on bytes Alex Shinn (29 Mar 2012 14:03 UTC)
Re: [Scheme-reports] Bitwise operations on bytes John Cowan (29 Mar 2012 16:15 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Alan Watson (29 Mar 2012 16:40 UTC)
Re: [Scheme-reports] Bitwise operations on bytes John Cowan (29 Mar 2012 17:40 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Per Bothner (29 Mar 2012 19:13 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Aaron W. Hsu (29 Mar 2012 20:18 UTC)
Re: Bitwise operations on bytes Arthur A. Gleckler (29 Mar 2012 20:20 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Aaron W. Hsu (29 Mar 2012 20:44 UTC)
Re: [Scheme-reports] Bitwise operations on bytes John Cowan (29 Mar 2012 20:30 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Per Bothner (29 Mar 2012 20:44 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Aubrey Jaffer (29 Mar 2012 17:56 UTC)
Re: [Scheme-reports] Bitwise operations on bytes John Cowan (29 Mar 2012 18:15 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Alan Watson (29 Mar 2012 18:26 UTC)
Re: [Scheme-reports] Bitwise operations on bytes Aubrey Jaffer (29 Mar 2012 19:56 UTC)

Re: [Scheme-reports] Bitwise operations on bytes Per Bothner 29 Mar 2012 20:44 UTC

On 03/29/2012 01:30 PM, John Cowan wrote:
> I wasn't speaking of an atomic instruction, but of the fact that to set one
> or more bits in a byte, you have to read the byte, modify it, and write it
> back.  This is far more expensive than setting all the bits in a byte,
> which is just a write.

That seems unlikely: Regardless, you have to read the whole cache line,
and the cost of the memory-to-cache transfer should swamp the cost
modifying a cache line.  If you're modifying multiple bits then
a compact encoding is likely to require fewer memory reads and
writes.

True, there are some overheads with extra indexing and masking.
I would expect the relative cost of bit-per-byte or bit-per-bit
wold depend on the distribution of bitvector size and frequencey,
memory architecure, instruction set, etc etc.  But in general
if you're dealing with large bitvectors the compact encoding seems
like it should win.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports