Skip to content

BuildUrl() Slowness #71

Open
Open
@mpwoodward

Description

@mpwoodward

I was just working through a performance issue with a couple of co-workers, and we narrowed things down to BuildUrl() being slow. Realizing the answer may be a simple "don't do that" I figured I'd pass this along anyway.

This is on Mach-II 1.8.1.

We have a query with about 50 records in it, and we're looping over that spitting out rows in an HTML table. We stripped out anything fancy (IOW no datatables/tablesorter kind of stuff enabled) so it's just looping over the query and creating table rows.

What triggered us looking into this was that to render that page with only 50 records was taking about 4 seconds, and we tried another query with 200 records and it'd take about 10 seconds to render the page. So we went through the usual troubleshooting steps to eliminate the database and everything else up and down the chain.

Each cell of each row has an onclick event, and there's 5 cells per row. For the onclick event BuildUrl() was being used, so that's 250 BuildUrl() calls in the table with 50 records.

As I said with BuildUrl() it was taking about 4 seconds to render the page, but when we removed BuildUrl() and hard-coded the URL for the onclick event (meaning the only change we made was to remove BuildUrl() and everything else stayed the same), the time went down to about 3 ms, so about a 1000X difference.

Again maybe the answer is "don't use that many BuildUrl() calls" but I wanted to pass it along in case it was something that needed to be looked into.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions