<p dir="ltr">On 25 Apr 2015 01:25, "Walter Bright via Digitalmars-d" <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br>
><br>
> On 4/24/2015 5:59 AM, John Colvin wrote:<br>
>><br>
>> one reason why it might be faster is that e.g. gcc can produce code like this:<br>
>><br>
>> #include<alloca.h><br>
>><br>
>> void bar(char* a);<br>
>><br>
>> void foo(unsigned int n)<br>
>> {<br>
>> char *a = (char*)alloca(n);<br>
>> bar(a);<br>
>> }<br>
>><br>
>> foo:<br>
>> movl %edi, %eax<br>
>> pushq %rbp<br>
>> addq $46, %rax<br>
>> movq %rsp, %rbp<br>
>> shrq $4, %rax<br>
>> salq $4, %rax<br>
>> subq %rax, %rsp<br>
>> leaq 31(%rsp), %rdi<br>
>> andq $-32, %rdi<br>
>> call bar<br>
>> leave<br>
>> ret<br>
>><br>
>> which is neat.<br>
><br>
><br>
> It's a cowboy implementation that's fine until it someone tries a largish value of n.<br>
></p>
<p dir="ltr">I wonder just how large... IIRC I think the limit on ubyte arrays is 1M?</p>