rasyahadlinugraha / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
0 stars 0 forks source link

MarkupIdVisitor forces children to be visited twice #152

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The implementation of MarkupIdVisitor leads to a very long runtime, since 
MarkupIdVisitor.component() calls MarkupContainer.visitChildren(), which is 
afterwards called again by Wicket's MarkupContainer.visitChildren() itself. 
This way, the runtime grows exponentially.

What steps will reproduce the problem?
1. Create a deep tree of Wicket components.
2. Run the MarkupIdVisitor, e.g. in DroppableAjaxBehavior.

Possible fix:
Remove 

if (component instanceof MarkupContainer) {
  return ((MarkupContainer) component).visitChildren(this);
}

in MarkupIdVisitor.component.

What version of the product are you using? On what operating system?
Version 1.2.1 on Ubuntu 64-Bit.

Original issue reported on code.google.com by simon.br...@googlemail.com on 26 Jan 2011 at 11:08

GoogleCodeExporter commented 9 years ago
Can you perhaps provide us with a quickstart or example project to test this? 
I'd like to test any fixes with the same sources as the reporter.

Original comment by hielke.hoeve on 27 Jan 2011 at 12:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have created a litte example project from your quickstart.
"HomePage" creates 25 containers, a draggable and a droppable. After dragging 
the draggable onto the droppable, a notification message appears.
This takes ~30 seconds for me.

Original comment by simon.br...@googlemail.com on 27 Jan 2011 at 6:24

Attachments:

GoogleCodeExporter commented 9 years ago
Oh yes, an obvious bug. This was probably added a long time ago to fix 
something in Wicket.

I have removed the extra call and the ajax call is near instant in FireFox 
3.6.13.

It's committed for WiQuery 1.1 trunk and WiQuery 1.2 trunk, if you are using 
sources then please update. Otherwise a SNAPSHOT release will come tomorrow.

Original comment by hielke.hoeve on 27 Jan 2011 at 8:12

GoogleCodeExporter commented 9 years ago
Hi,

I have a similar problem using SortableAjaxBehavior. 

The call from line 396 in SortableAjaxBehavior: 

/* line :395*/MarkupIdVisitor visitor = new MarkupIdVisitor(input);
/* line :396*/this.getComponent().getPage().visitChildren(visitor);

takes a lot of time when I have a page with a deep hierarchy of containers.

Inspecting the MarkupIdVisitor class, it seems like the extra call is still 
there:

if (component instanceof MarkupContainer)
        {
            ((MarkupContainer) component).visitChildren(Component.class, this);
        }

The version of wiquery-core I'm using in my project is : wiquery-core-1.5.6.
In which version is this fixed? It seems that the trunk does still contain this 
line and the newest version of this file is from 22 September 2011.

Thanks,
Cristi

Original comment by cristi.c...@gmail.com on 10 Aug 2012 at 12:07

GoogleCodeExporter commented 9 years ago
I have checked it again with wiquery-jquery-ui version 1.5.7 and wicket 1.5.7 
and it is not fixed. Running the attached application took on my machine almost 
8 seconds for the ajax call to complete. Can you please tell me on which 
version is it fixed? (The trunk contains the same version shown in my previous 
comment).

Original comment by cristi.c...@gmail.com on 9 Nov 2012 at 3:40

Attachments: