SelectOneMenu: Options to improve client side (browser) render performance?

UI Components for JSF
tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

14 Jan 2020, 14:19

Good to hear!
This is the update-handler for custom content, you can find the method param when you search for PrimeFaces.ajax.Response.handle; example in forms.selectonemenu.js line 973
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

stolp
Posts: 127
Joined: 21 Aug 2018, 16:05

14 Jan 2020, 14:41

So I assume it would make sense to add an optimization path for the common case of only whitespace content?

I am going to give #5520 another test run, I saw this got just added.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

14 Jan 2020, 14:50

So I assume it would make sense to add an optimization path for the common case of only whitespace content?
Not sure :D i dont know what happens. If you can explain, i can try to understand your case with "whitespace content"
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

stolp
Posts: 127
Joined: 21 Aug 2018, 16:05

14 Jan 2020, 15:30

Sorry for being too terse.

What I meant is, that an overwhelming number of all p:selectOneMenus in the wild will not contain any custom content.

My assumption is, that in this case the content argument will be empty and we may be able to skip the parsing.

Code: Select all

onsuccess: function(responseXML, status, xhr) {
                PrimeFaces.ajax.Response.handle(responseXML, status, xhr, {
                    widget: $this,
                    handle: function(content) {
                        var $content = $($.parseHTML(content));

                        var $ul = $content.filter('ul');
                        $this.itemsWrapper.empty();
                        $this.itemsWrapper.append($ul);

                        var $select = $content.filter('select');
                        $this.input.replaceWith($select);
                    }
                });

                return true;
            },
I might be utterly wrong though. In this case please ignore :)

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

14 Jan 2020, 16:03

Did you try setting a breakpoint and inspect? I'd expect content to be identical to the normal content but that is just my expectation.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

14 Jan 2020, 17:36

yep, please debug
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

stolp
Posts: 127
Joined: 21 Aug 2018, 16:05

15 Jan 2020, 00:53

Ok, I spend some more time with this.

First, the content is indeed never empty in the onsuccess function shown above, but this does not matter.

Second, the last performance bottleneck shown is a call to paginate.onsuccess (Ajax pagination), containing the new 200 rows for the data table (1 MB in size).

I fear that other than cutting down on complexity of the table content there is no other way to speed this up.

Thank you for bearing with my ineptitude with Javascript tools and the quick fixes. Regarding the performance of SelectOneMenu I think we can close this.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

15 Jan 2020, 10:55

What exctly is paginate.onsucess? Maybe we can optimize this method
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

stolp
Posts: 127
Joined: 21 Aug 2018, 16:05

15 Jan 2020, 11:10

See line 1388 in datatable.js, calling updateData() in line 4256. The time is spent in appending child nodes.

Maybe native methods are faster than jquery append operations?

I added another performance trace for reference: https://www.file-upload.net/download-13 ... e.png.html

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

15 Jan 2020, 11:37

Yep, i see
of course native is faster

Can you try to change updateData by yourself and test everything + compare the results?
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests