Dan Sugalski wrote:
At 11:57 AM +0200 6/14/04, Leopold Toetsch wrote:

1) Is there any good reason to start now malloc(3) based array classes? This leads to code duplication for all the utility vtable entries (like C<splice>). F<src/list.c> can deal with all types already.

list.c's pretty inefficient for most array usage. It's good for mixed-type, sparse, or really big arrays, but for normal arrays it's overkill. A big wad of memory's just fine there.

Well, yes. It depends on the usage of the PMC, which isn't known. What about shift/unshift? Are these allowed for fixed sized arrays?


I'd vote for optimizing list.c for the "small usage pattern" and switch to a different strategy for big arrays.

Anyway, the patch #30245 Resizable*Array implements these arrays on top of fixed size. We had that some times ago with Array/PerlArray. It was around 100 times slower for growing usage like:

  @ar[$_] = $x for (0..$N)

for some big $N.

And it of course duplicates existing classes like IntList, which just needs to get renamed.

2) What's the difference between *PMCArray and *BooleanArray?


The PMC arrays hold PMCs. The Boolean arrays hold true/false values only.

Then it should really store just one bit instead of a word.

leo



Reply via email to