Page 2 of 4

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

Posted: 14 Jan 2020, 14:19
by tandraschko
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

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

Posted: 14 Jan 2020, 14:41
by stolp
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.

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

Posted: 14 Jan 2020, 14:50
by tandraschko
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"

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

Posted: 14 Jan 2020, 15:30
by stolp
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 :)

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

Posted: 14 Jan 2020, 16:03
by kukeltje
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.

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

Posted: 14 Jan 2020, 17:36
by tandraschko
yep, please debug

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

Posted: 15 Jan 2020, 00:53
by stolp
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.

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

Posted: 15 Jan 2020, 10:55
by tandraschko
What exctly is paginate.onsucess? Maybe we can optimize this method

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

Posted: 15 Jan 2020, 11:10
by stolp
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

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

Posted: 15 Jan 2020, 11:37
by tandraschko
Yep, i see
of course native is faster

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