[Issue 8550] std.container.InlinedArray

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8550

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P4

--


[Issue 8550] std.container.InlinedArray

2012-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8550


Daniel Cousens daniel...@bigpond.com changed:

   What|Removed |Added

 CC||daniel...@bigpond.com


--- Comment #1 from Daniel Cousens daniel...@bigpond.com 2012-08-15 06:30:37 
PDT ---
This is a very cool idea. 

The concept put simply is just your typical dynamic array with a pre-allocated
buffer that it *can* use up until it surpasses that buffer, in which case that
buffer is then ignored (at the cost of the size of the buffer, which is
probably negligible in most cases).

The only problems I can foresee is perhaps little 'gotchas' in that union of a
dynamic array and static array. I'd have to investigate to know for sure on
that. 
Lots of unit tests for this I think, and definitely some information needed
from those in the know about the compiler back end.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8550] std.container.InlinedArray

2012-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8550


Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com


--- Comment #2 from Dmitry Olshansky dmitry.o...@gmail.com 2012-08-15 
11:35:56 PDT ---
This is called small array optimization except for size of array is hardwired
so that the whole struct fits a couple of words. I suggest to just add it to
std.container.Array.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8550] std.container.InlinedArray

2012-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8550



--- Comment #3 from bearophile_h...@eml.cc 2012-08-15 15:34:34 PDT ---
(In reply to comment #2)
 This is called small array optimization except for size of array is hardwired
 so that the whole struct fits a couple of words. I suggest to just add it to
 std.container.Array.

Yes, this is similar to small array optimization, but this variant of the idea
allows you to tune how much space you want to save locally.

Beside staticLen, this InlinedArray also optionally takes the Tlen type. If you
are using something very small, like ubytes or chars or shorts, and you want to
pack as many of them as possible in the local static array, you are allowed to
define Tlen as ubyte (or ushort) instead of uint or size_t. So
InlinedArray!(int,1) takes 12 bytes and stores up to 11 ubytes/chars.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---