Home » Eclipse Projects » Remote Application Platform (RAP) » Table.indexOf not optimized like in SWT
|
Re: Table.indexOf not optimized like in SWT [message #131124 is a reply to message #131085] |
Mon, 04 May 2009 14:29   |
Ivan Furnadjiev Messages: 2413 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Enrico,
it is already optimized in CVS HEAD :-). See this bug:
273433: [Table] render phase becomes slow when having many Items
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273433
Best,
Ivan
Enrico Zanaga wrote:
> Hi,
>
> I noticed that Table.indexOf in SWT looks like this:
>
> public int indexOf (TableItem item) {
> checkWidget ();
> if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
> int count = (int)OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
> if (1 <= lastIndexOf && lastIndexOf < count - 1) {
> if (items [lastIndexOf] == item) return lastIndexOf;
> if (items [lastIndexOf + 1] == item) return ++lastIndexOf;
> if (items [lastIndexOf - 1] == item) return --lastIndexOf;
> }
> if (lastIndexOf < count / 2) {
> for (int i=0; i<count; i++) {
> if (items [i] == item) return lastIndexOf = i;
> }
> } else {
> for (int i=count - 1; i>=0; --i) {
> if (items [i] == item) return lastIndexOf = i;
> }
> }
> return -1;
> }
>
>
> While in RWT looks like:
>
> public int indexOf( final TableItem item ) {
> checkWidget();
> if( item == null ) {
> SWT.error( SWT.ERROR_NULL_ARGUMENT );
> }
> int result = -1;
> for( int i = 0; result == -1 && i < itemCount; i++ ) {
> if( items[ i ] == item ) {
> result = i;
> }
> }
> return result;
> }
>
>
> In RWT when a list contains 10000 items, the indexOf scroll all over
> the 10000 items to find the index boosting the CPU at 100%.
>
> Is it possible to optimize the Table.indexOf method like in SWT?
>
> Thanks,
> Enrico
|
|
|
Re: Table.indexOf not optimized like in SWT [message #131227 is a reply to message #131124] |
Mon, 04 May 2009 17:23   |
Enrico Zanaga Messages: 50 Registered: July 2009 |
Member |
|
|
Hi Ivan,
I've downloaded the version from CVS HEAD, but now the server sends all
the 10000 items of the list to the client.
Now the browser consumes 100% CPU.
In the M6 only the visible rows were send to the client, why not in CSV
HEAD?
Thanks,
Enrico
Ivan Furnadjiev ha scritto:
> Hi Enrico,
>
> it is already optimized in CVS HEAD :-). See this bug:
>
> 273433: [Table] render phase becomes slow when having many Items
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=273433
>
> Best,
> Ivan
>
> Enrico Zanaga wrote:
>> Hi,
>>
>> I noticed that Table.indexOf in SWT looks like this:
>>
>> public int indexOf (TableItem item) {
>> checkWidget ();
>> if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
>> int count = (int)OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
>> if (1 <= lastIndexOf && lastIndexOf < count - 1) {
>> if (items [lastIndexOf] == item) return lastIndexOf;
>> if (items [lastIndexOf + 1] == item) return ++lastIndexOf;
>> if (items [lastIndexOf - 1] == item) return --lastIndexOf;
>> }
>> if (lastIndexOf < count / 2) {
>> for (int i=0; i<count; i++) {
>> if (items [i] == item) return lastIndexOf = i;
>> }
>> } else {
>> for (int i=count - 1; i>=0; --i) {
>> if (items [i] == item) return lastIndexOf = i;
>> }
>> }
>> return -1;
>> }
>>
>>
>> While in RWT looks like:
>>
>> public int indexOf( final TableItem item ) {
>> checkWidget();
>> if( item == null ) {
>> SWT.error( SWT.ERROR_NULL_ARGUMENT );
>> }
>> int result = -1;
>> for( int i = 0; result == -1 && i < itemCount; i++ ) {
>> if( items[ i ] == item ) {
>> result = i;
>> }
>> }
>> return result;
>> }
>>
>>
>> In RWT when a list contains 10000 items, the indexOf scroll all over
>> the 10000 items to find the index boosting the CPU at 100%.
>>
>> Is it possible to optimize the Table.indexOf method like in SWT?
>>
>> Thanks,
>> Enrico
|
|
|
Re: Table.indexOf not optimized like in SWT [message #131241 is a reply to message #131227] |
Mon, 04 May 2009 18:25   |
Rüdiger Herrmann Messages: 581 Registered: July 2009 |
Senior Member |
|
|
Enrico,
I did y quick check, but I cannot reproduce what you describe.
Please note that you need to specify the VIRTUAL flag in order to
not have sent all the times to the client.
Please file a bugzilla if you can reproduce the problem.
HTH
Rüdiger
Enrico Zanaga wrote:
> Hi Ivan,
>
> I've downloaded the version from CVS HEAD, but now the server sends all
> the 10000 items of the list to the client.
> Now the browser consumes 100% CPU.
> In the M6 only the visible rows were send to the client, why not in CSV
> HEAD?
>
> Thanks,
> Enrico
>
>
> Ivan Furnadjiev ha scritto:
>> Hi Enrico,
>>
>> it is already optimized in CVS HEAD :-). See this bug:
>>
>> 273433: [Table] render phase becomes slow when having many Items
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=273433
>>
>> Best,
>> Ivan
>>
>> Enrico Zanaga wrote:
>>> Hi,
>>>
>>> I noticed that Table.indexOf in SWT looks like this:
>>>
>>> public int indexOf (TableItem item) {
>>> checkWidget ();
>>> if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
>>> int count = (int)OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
>>> if (1 <= lastIndexOf && lastIndexOf < count - 1) {
>>> if (items [lastIndexOf] == item) return lastIndexOf;
>>> if (items [lastIndexOf + 1] == item) return ++lastIndexOf;
>>> if (items [lastIndexOf - 1] == item) return --lastIndexOf;
>>> }
>>> if (lastIndexOf < count / 2) {
>>> for (int i=0; i<count; i++) {
>>> if (items [i] == item) return lastIndexOf = i;
>>> }
>>> } else {
>>> for (int i=count - 1; i>=0; --i) {
>>> if (items [i] == item) return lastIndexOf = i;
>>> }
>>> }
>>> return -1;
>>> }
>>>
>>>
>>> While in RWT looks like:
>>>
>>> public int indexOf( final TableItem item ) {
>>> checkWidget();
>>> if( item == null ) {
>>> SWT.error( SWT.ERROR_NULL_ARGUMENT );
>>> }
>>> int result = -1;
>>> for( int i = 0; result == -1 && i < itemCount; i++ ) {
>>> if( items[ i ] == item ) {
>>> result = i;
>>> }
>>> }
>>> return result;
>>> }
>>>
>>>
>>> In RWT when a list contains 10000 items, the indexOf scroll all over
>>> the 10000 items to find the index boosting the CPU at 100%.
>>>
>>> Is it possible to optimize the Table.indexOf method like in SWT?
>>>
>>> Thanks,
>>> Enrico
|
|
|
Re: Table.indexOf not optimized like in SWT [message #131254 is a reply to message #131227] |
Mon, 04 May 2009 18:31  |
Ivan Furnadjiev Messages: 2413 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Enrico,
are you using a virtual table? Can you post a simple snippet that
demonstrate this behavior?
Best,
Ivan
Enrico Zanaga wrote:
> Hi Ivan,
>
> I've downloaded the version from CVS HEAD, but now the server sends
> all the 10000 items of the list to the client.
> Now the browser consumes 100% CPU.
> In the M6 only the visible rows were send to the client, why not in
> CSV HEAD?
>
> Thanks,
> Enrico
>
>
> Ivan Furnadjiev ha scritto:
>> Hi Enrico,
>>
>> it is already optimized in CVS HEAD :-). See this bug:
>>
>> 273433: [Table] render phase becomes slow when having many Items
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=273433
>>
>> Best,
>> Ivan
>>
>> Enrico Zanaga wrote:
>>> Hi,
>>>
>>> I noticed that Table.indexOf in SWT looks like this:
>>>
>>> public int indexOf (TableItem item) {
>>> checkWidget ();
>>> if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
>>> int count = (int)OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
>>> if (1 <= lastIndexOf && lastIndexOf < count - 1) {
>>> if (items [lastIndexOf] == item) return lastIndexOf;
>>> if (items [lastIndexOf + 1] == item) return ++lastIndexOf;
>>> if (items [lastIndexOf - 1] == item) return --lastIndexOf;
>>> }
>>> if (lastIndexOf < count / 2) {
>>> for (int i=0; i<count; i++) {
>>> if (items [i] == item) return lastIndexOf = i;
>>> }
>>> } else {
>>> for (int i=count - 1; i>=0; --i) {
>>> if (items [i] == item) return lastIndexOf = i;
>>> }
>>> }
>>> return -1;
>>> }
>>>
>>>
>>> While in RWT looks like:
>>>
>>> public int indexOf( final TableItem item ) {
>>> checkWidget();
>>> if( item == null ) {
>>> SWT.error( SWT.ERROR_NULL_ARGUMENT );
>>> }
>>> int result = -1;
>>> for( int i = 0; result == -1 && i < itemCount; i++ ) {
>>> if( items[ i ] == item ) {
>>> result = i;
>>> }
>>> }
>>> return result;
>>> }
>>>
>>>
>>> In RWT when a list contains 10000 items, the indexOf scroll all over
>>> the 10000 items to find the index boosting the CPU at 100%.
>>>
>>> Is it possible to optimize the Table.indexOf method like in SWT?
>>>
>>> Thanks,
>>> Enrico
|
|
|
Goto Forum:
Current Time: Mon Jun 05 17:17:09 GMT 2023
Powered by FUDForum. Page generated in 0.02786 seconds
|