8000 [WebProfilerBundle] Improve performance by javiereguiluz · Pull Request #54421 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Improve performance #54421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

javiereguiluz
Copy link
Member
Q A
Branch? 7.1
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

This PR tries to solve the following problem:

When clicking on panels like Logs or Doctrine, the page contents take some time to be ready ... and the JavaScript code that runs to change/Add things to UI, produces visible jumps:

profiler-panel-jump.mp4

I debugged this behavior and the browser shows a "Long Task" warning message but not many other details:

image

I followed Google's recommendations: https://web.dev/articles/optimize-long-tasks and split the SymfonyProfiler tasks in two group: critical (menu and tabs) and normal (the rest of features).

That change in addition to <meta name="view-transition" content="same-origin"> improves the situation, but it's still not perfect.

So, this PR is mostly a call for help to JavaScript experts. Please help us make the UI as fast as possible. Thanks!

@javiereguiluz javiereguiluz added WebProfilerBundle Help wanted Issues and PRs which are looking for volunteers to complete them. labels Mar 27, 2024
@javiereguiluz javiereguiluz added this to the 7.1 milestone Mar 27, 2024
@carsonbot carsonbot changed the title (WIP) [WebProfilerBundle] Improve performance [WebProfilerBundle] (WIP) Improve performance Mar 27, 2024
fabpot added a commit that referenced this pull request Apr 5, 2024
…filer layout (javiereguiluz)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[WebProfilerBundle] Update the search links in the profiler layout

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | -
| License       | MIT

While working on #54421, I noticed that the page jump is mostly caused by the "profile search form" that we embed in the page via Ajax. This is how it looks expanded:

![image](https://github.com/symfony/symfony/assets/73419/090febc8-65e6-4ede-8c21-8b3fb0d738d2)

However, thew workflow is as follows:

1. Click on `Search` link
2. The embedded search form expands
3. Input the search criteria
4. Click on `Search` button
5. You are redirected to the Search page to see the results

-----

In this PR, I propose to NOT embed the search form in any pages and change the workflow as follows:

1. Click on `Search` link
2. You are redirected to the Search page to see the results
3. Input the search criteria (in the already expanded search form)
4. Click on `Search` button to see the results

This fixes some of the perceived performance slowdown and looks like a better workflow to me.

-----

Also, the current sidebar shows these shortcut links:

![image](https://github.com/symfony/symfony/assets/73419/1ef165fe-1ac1-42ff-8d01-1514c2b2320f)

* "Last 10" shows the 10 most recent profiles
* "Latest" shows the most recent profile available
* "Search" expands the search form

This PR changes it to only show 2 shortcuts:

* "Search profiles" shows the last 10 profiles and also the search form expanded
* "Latest" shows the most recent profile aaailable

It looks like this:

![search-links](https://github.com/symfony/symfony/assets/73419/8f2ba944-c9a3-4f56-9a12-4818c79bfdcb)

Commits
-------

7baa29e [WebProfilerBundle] Update the search links in the profiler layout
@smnandre
Copy link
Member

To avoid any redraw and ensure maximum performances, we should implement the reordering directly in CSS

#menu-profiler {
  /** ... existing rules */
  display: flex;
  flex-direction: column;
}
#menu-profiler li:has(span.disabled) {
    order: 1;
}

(:has is baseline in 2023 so this work for more than 95% of users, and the few ones with browsers not implementing :has will just see the list as before)

@javiereguiluz javiereguiluz changed the title [WebProfilerBundle] (WIP) Improve performance [WebProfilerBundle] Improve performance Apr 12, 2024
@javiereguiluz
Copy link
Member Author

Simon, you are a genius 🙇 🙇 I did what you suggested: it works perfectly and it solves the remaining performance issues. The profiler pages now feel very snappy. Thanks!

This is now ready for a final review.

@javiereguiluz javiereguiluz added ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" and removed Status: Needs Work Help wanted Issues and PRs which are looking for volunteers to complete them. labels Apr 12, 2024
@smnandre
Copy link
Member

The profiler pages now feel very snappy.

❤️ Thank you for tackling those issues :)

@fabpot fabpot force-pushed the profiler_performance branch from 493b2f9 to 29a271b Compare April 13, 2024 07:14
@fabpot
Copy link
Member
fabpot commented Apr 13, 2024

Thank you @javiereguiluz.

@fabpot fabpot merged commit c29b7a9 into symfony:7.1 Apr 13, 2024
@javiereguiluz javiereguiluz deleted the profiler_performance branch April 13, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed WebProfilerBundle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0