use Inline C => <<'EoF'; void fast_c (int num, ...) { Inline_Stack_Vars; int rnum = num; SV** buckets; int stack_ptr = Inline_Stack_Items - 1; buckets = (SV**)malloc(sizeof(SV*) * num); while (rnum) { int this = stack_ptr / rnum--; AV* bucket = newAV(); while (this--) { av_unshift(bucket, 1); av_store(bucket, 0, Inline_Stack_Item(stack_ptr--)); } buckets[rnum] = newRV_inc((SV*)bucket); } Inline_Stack_Reset; while (rnum < num) { Inline_Stack_Push(sv_2mortal(buckets[rnum++])); } free(buckets); Inline_Stack_Done; Inline_Stack_Return(num); } EoF