Patch: FYI: natFile -vs- stack

Tom Tromey tromey@redhat.com
Thu Feb 7 17:38:00 GMT 2002


>>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:

>> This changes natFile.cc so that it doesn't stack allocate any
>> buffers, and so that the buffers it allocates are the right size.

Bryce> I think its very unfortunate (for performance) to be allocating
Bryce> on every stat() call etc. Is there no other way to fix this?
Bryce> How about __builtin_alloca() ?

I was reluctant to do that given that we don't have stack overflow
checking.  Also in the past Hans has implied that heap allocating
isn't necessarily much more expensive than stack allocating (or I've
severely misread his comments, apologies for misrepresentations, etc).

We could cache the allocation.  This would make each File a bit
larger.  This might make sense if we decide to use the locale's
encoding for file names, since in that case converting from String to
the char* array will be more expensive.

Tom



More information about the Java-patches mailing list