commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <mcucchi...@apache.org>
Subject Re: [ognl] internal cache performance improvement
Date Tue, 07 Jun 2011 06:50:01 GMT
Forget about key collision, obviously there is no collisions fro a
non-hash functions.

On 7 June 2011 02:43, Maurizio Cucchiara <mcucchiara@apache.org> wrote:
> Simone,
>
>> a look at put( Class<?> key, T value )[1] implementation of
>
> Aside that put method is public, IIUC the only class that calls "put"
> is only the OgnlRuntime one (and almost every time it invokes inside
> a sync block).
>
>> ClassCacheImpl: the whole block should be controlled by a concurrency
>> policy, not only the access to the data structure... WDYT?
>> The main reason of proposing a TreeMap instead of an LRU cache is
>> that, in the curent implementation, for each key there could be more
>> than one value, keeping the multiple values in a kind of inefficient
>> linked list, that makes inserts/searches inefficient with complexity
>> of O(n), with TreeMap we can decrease it to O(log n).
>
> I'm not sure understand what you mean, how do you think to handle the
> key collisions (not even TreeMap supports duplicate keys)?
> At least an HashMap implementation (et similia) can guarantee a lower
> complexity than TreeMap (unless the order is not important), or am I
> missing something?
>
> I supposed that the new map implementation will replace the _table
> array, please correct me if I'm wrong.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message