I think that if other people's testing also shows that heap buffers offer better performance than direct buffers then that should be the default. As you say, the default choice should be the one that is appropriate for most cases.
Maybe it makes sense to have the default allocator the pooled allocator when using direct buffers and the simple allocator when using heap buffers?
Robert
| "Trustin Lee" <[EMAIL PROTECTED]>
01/05/2006 03:41
|
To: [email protected] cc: Subject: Re: Performance - some interesting results |
On 5/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Out of curiosity, why do you not use -server?
>
> One serious issue with direct buffers is that you can declare a lot of
> them, throw away the reference and the memory will not be reclaimed until
> the GC kicks in. This may not be for some time since it depends what is in
> the heap. Even if you allocate huge direct buffers it isn't going to make GC
> happen any more quickly. I think it would have been better if ByteBuffer had
> a dispose() method.
>
> Since you find that heap buffers offer better performance for you, is the
> greater memory footprint with direct buffers really an issue for you?
>
This thread definitely raises very interesting performance issues as you
mentioned initially. Most modern JVMs are showing that heap buffers show
better performance and memory utilization than direct buffers do. The
buffer pooling was originally to save time to allocate direct buffers
because it usually takes a lot of time comparing to the time taken while
heap buffers are allocated. If heap buffers are much better choice for most
cases, then we need to adjust our default allocation behavior.
If we change the default buffer type to 'heap', we'll also have to change
the default allocator to SimpleByteBufferAllocator. WDYT?
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.
