Quantcast

Impact of ListEvent.getOld/NewValue()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Impact of ListEvent.getOld/NewValue()

robeden
Hi guys -

Anyone remember what caused ListEvent.getOldValue() and .getNewValue() to be added? What implementations needs that?

The reason I ask is I've been chasing a performance problem and found that events are no longer batching the way they used to (apparently many moons ago) due to the old value logic.

To illustrate, here's the example given in the ListEvent documentation pertaining to batches:
     final EventList<String> list = 
          GlazedLists.eventListOf( "A", "A", "B", "B", "C", "C" );
     list.removeAll( GlazedLists.eventListOf( "A", "C" ) );
This does correctly fire two events as expected: X0-2, X2-4

However, here's another example that would seem to be the same thing:
     final EventList<String> list = 
          GlazedLists.eventListOf( "A", "B", "C", "D", "E", "F" );
     list.removeAll( GlazedLists.eventListOf( "A", "B", "E', "F" ) );
This fires four events: X0-1, X0-1, X2-3, X2-3

The reason is that the events are separated out because the old value doesn't match.

To illustrate the MASSIVE impact this has:
     final EventList<String> list = 
          GlazedLists.eventListOf( "A", "B", "C", "D", "E", "F" );
     list.clear();
fires six events: X0-1, X0-1, X0-1, X0-1, X0-1, X0-1

FYI, the applicable logic appears to be in BlockSequence.addChange(...).

So, one thought I had was to try to identify whether or not the values were necessary and only provide them if needed... but it's difficult to immediately tell how hard that would be. (I'm digging through usages of the get*Value() methods now, but there's a lot of noise.)

I'm on Gitter if anyone wants to discuss "live": https://gitter.im/glazedlists/glazedlists

Rob
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Impact of ListEvent.getOld/NewValue()

hbrands
Administrator
Hey Rob,

sorry for the delay.

2015-03-04 17:12 GMT+01:00 Rob Eden <[hidden email]>:

Hi guys -

Anyone remember what caused ListEvent.getOldValue() and .getNewValue() to be added? What implementations needs that?



I think it started with the attempt by Jesse to provide the deleted element in the list events, see GLAZEDLISTS-253
It was then extended to also provide the updated and inserted elements,
but it was never finished and is work in progress.

Holger

 
Loading...