phobos icon indicating copy to clipboard operation
phobos copied to clipboard

Short array optimization for std.bitmanip.BitArray

Open dlangBugzillaToGithub opened this issue 13 years ago • 1 comments

bearophile_hugs reported this on 2012-02-12T11:59:28Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=7488

CC List

  • andrei (@andralex)
  • lovelydear

Description

An optimization for std.bitmanip.BitArray: when BitArray.length <= (size_t.sizeof * 8), then BitArray.ptr stores the bit themselves (so ptr is in a union with a size_t).

If the array of bits is short, this saves a GC allocation, increasing performance and reducing the amount of memory used and garbage produced.

dlangBugzillaToGithub avatar Feb 12 '12 11:02 dlangBugzillaToGithub

lovelydear commented on 2012-04-19T08:54:38Z

See related 7487 and 7490

dlangBugzillaToGithub avatar Apr 19 '12 08:04 dlangBugzillaToGithub