Skip to content

Experimental Workload: Responsive Design #453

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

issackjohn
Copy link
Contributor

@issackjohn issackjohn commented Nov 15, 2024

This pull request introduces a new experimental responsive design workload, featuring a single-page cooking website built with Lit and Tailwind CSS.

The hosted version can be found here.
Quick link to dev mode with workload selected.

Please look at the README in experimental/responsive-design for more information about the code and how it is organized.

Not included in this PR:

  • Support for different languages

@issackjohn issackjohn force-pushed the responsive-design branch 2 times, most recently from 1da5897 to 34a545e Compare November 15, 2024 19:19
@issackjohn issackjohn requested review from julienw and removed request for julienw November 15, 2024 19:22
@issackjohn issackjohn marked this pull request as ready for review November 15, 2024 19:22
@issackjohn
Copy link
Contributor Author

Adding reviewers for visibility, feel free to take a look :)

@rniwa
Copy link
Member

rniwa commented Nov 15, 2024

It seems to me that the test doesn't really take the advantage of responsive design since iframe's size is always same. Maybe we should add steps to resize iframe so that responsive design comes into play?

@issackjohn
Copy link
Contributor Author

It seems to me that the test doesn't really take the advantage of responsive design since iframe's size is always same. Maybe we should add steps to resize iframe so that responsive design comes into play?

Currently, we are resizing the the iframe with id #content-iframe in the ReduceWidthIn5Steps & IncreaseWidthIn5Steps steps. Do you mean that we should be resizing a different iframe?

@rniwa
Copy link
Member

rniwa commented Nov 15, 2024

It seems to me that the test doesn't really take the advantage of responsive design since iframe's size is always same. Maybe we should add steps to resize iframe so that responsive design comes into play?

Currently, we are resizing the the iframe with id #content-iframe in the ReduceWidthIn5Steps & IncreaseWidthIn5Steps steps. Do you mean that we should be resizing a different iframe

Oh, I see. We're resizing the inner iframe. I guess that works.

@issackjohn
Copy link
Contributor Author

Gentle ping 😄

@camillobruni
Copy link
Contributor

I still see rather short run times for individual steps (close to 1.6ms in chrome canary) which might introduce a bit too much noise in the long run.

Responsive-Design
Responsive-Design/LoadChatAndExpandRecipe	5.85	±	0.46 (7.9%)	ms
Responsive-Design/ReduceWidthIn5Steps  12.96	±	0.45 (3.5%)	ms
Responsive-Design/ScrollToChatAndSendMessage	1.68	±	0.07 (4.4%)	ms
Responsive-Design/IncreaseWidthIn5Steps	11.37	±	0.28 (2.5%)	

ScrollToChatAndSendMessage and (and especially it's sub-items) will show some aliasing from timer resolution which is ~ 0.1ms on chrome.
In general, i'd bump the step durations by 1.5x or 2x even to be on par with other workloads.

<title>Cooking with Lit and Tailwind</title>
</head>
<body style="overflow: hidden; margin: 0">
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html" width="800px" height="600px" style="border: none"></iframe>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we start off with 100% width/height as the maximum size (the step-resize sounds ok to be done with explicit sizes again)?
Albeit not fully exposed, we can set a custom viewport size in the params.mjs and it's used in the runner.
This workload would currently not support this directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@issackjohn
Copy link
Contributor Author

I still see rather short run times for individual steps (close to 1.6ms in chrome canary) which might introduce a bit too much noise in the long run.

Responsive-Design
Responsive-Design/LoadChatAndExpandRecipe	5.85	±	0.46 (7.9%)	ms
Responsive-Design/ReduceWidthIn5Steps  12.96	±	0.45 (3.5%)	ms
Responsive-Design/ScrollToChatAndSendMessage	1.68	±	0.07 (4.4%)	ms
Responsive-Design/IncreaseWidthIn5Steps	11.37	±	0.28 (2.5%)	

ScrollToChatAndSendMessage and (and especially it's sub-items) will show some aliasing from timer resolution which is ~ 0.1ms on chrome. In general, i'd bump the step durations by 1.5x or 2x even to be on par with other workloads.

To bump up the step durations, I am thinking of

  1. Expanding all the recipes as part of LoadChatAndExpandRecipe
  2. Collapsing all the recipes as part of ScrollToChatAndSendMessage
    2.1 Sending a few more messages in the chat instead of just one.

currently no proposed changes for ReduceWidthIn5Steps & IncreaseWidthIn5Steps

@flashdesignory
Copy link
Contributor

Some visual questions - these might not be relevant to the tests:

Is this spacing as expected?
Screenshot 2024-12-09 at 10 08 00 PM

The collapsed grid looks fine, but once expanded, the item moves to the next row - is that expected?
collapsed
Screenshot 2024-12-09 at 10 08 09 PM

expanded
Screenshot 2024-12-09 at 10 08 15 PM

The video tiles don't work - those are just placeholders?
Screenshot 2024-12-09 at 10 08 34 PM

@issackjohn
Copy link
Contributor Author

Some visual questions - these might not be relevant to the tests:

Is this spacing as expected?

I'll add a fix for that. The webpage was designed to be viewed in 800x600, as that's how it will appear within the benchmark.

The collapsed grid looks fine, but once expanded, the item moves to the next row - is that expected? collapsed

Yes, that is expected. Do we prefer a different behavior?

The video tiles don't work - those are just placeholders?

Yes, they are just placeholders. We intended the video elements to be there but did not plan for them to play any actual videos.

@flashdesignory
Copy link
Contributor

Some visual questions - these might not be relevant to the tests:
Is this spacing as expected?

I'll add a fix for that. The webpage was designed to be viewed in 800x600, as that's how it will appear within the benchmark.

  • Thanks - I'd vote for supporting larger viewport sizes. This will ensure that the workload looks usable at larger viewports, in case we want to change what's supported in Speedometer later on.

The collapsed grid looks fine, but once expanded, the item moves to the next row - is that expected? collapsed

Yes, that is expected. Do we prefer a different behavior?

I guess it makes sense for the tests, since it shifts elements on the page. That said, it's not something you'd see on the web (hopefully). I'd expected a modal or something like that instead.

The video tiles don't work - those are just placeholders?

Yes, they are just placeholders. We intended the video elements to be there but did not plan for them to play any actual videos.

Thanks for clarifying.

@flashdesignory
Copy link
Contributor

@issackjohn - maybe rebase / merge main, to get the updated test runner in there. That should ensure the checks don't fail.

@camillobruni
Copy link
Contributor

Let's aim for > 5ms for each measured subtest (I'd still aim for roughly 10ms if possible). Does this sound reasonable?

@issackjohn
Copy link
Contributor Author

@issackjohn - maybe rebase / merge main, to get the updated test runner in there. That should ensure the checks don't fail.

Sounds good.

@issackjohn
Copy link
Contributor Author

Let's aim for > 5ms for each measured subtest (I'd still aim for roughly 10ms if possible). Does this sound reasonable?

Sounds reasonable to me, I'll add some more actions.

@camillobruni
Copy link
Contributor

Just double checked on Chrome, Firefox, Safari and the noise levels are in-sync with the rest of the workloads.
The minimum step times look good now I would say.

@issackjohn
Copy link
Contributor Author

Thanks! Looking forward to addressing anymore feedback from folks.

Copy link

netlify bot commented Feb 11, 2025

Deploy Preview for webkit-speedometer ready!

Name Link
🔨 Latest commit 698c725
🔍 Latest deploy log https://app.netlify.com/sites/webkit-speedometer/deploys/67d4a0f54b21080008d5e50e
😎 Deploy Preview https://deploy-preview-453--webkit-speedometer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ths looks pretty good to me!

I see that when running npm run dev the dist files get overridden. Do you know if we can make it so the dev files are written in a different location, to minimize risks of errors in the future?

Otherwise my main issue is that the width setting in ReduceWidthIn5Steps and IncreaseWidthIn5Steps don't seem to be captured properly, at least in Firefox on my current machine (which is a bit slow). IMO this needs to be fixed, but this can be done in a follow-up.

Then I have a few more minor comments here and there. I haven't looked very closely at the tailwind code because I'm not familiar with it.
Also I wonder if we could include matchMedia somewhere.

Thanks!

Please add new changes in a separate commit.

@@ -35,3 +35,4 @@

/resources/charts/node_modules/
/resources/todomvc/big-dom-generator/node_modules/
/experimental/responsive-design/node_modules/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point, we should just add node_modules which would ignore all directories name that way :-) (but that can be done in a follow-up PR)

Comment on lines +1 to +2
src/tailwind.generated.css
src/tailwind.chat-window.generated.css
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use *.generated.css?

@@ -46,3 +46,5 @@ package-lock.json
/resources/perf.webkit.org

/resources/react-stockcharts

/experimental/responsive-design/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove that, we want the workload to follow the same code style.

The 2 existing ignores are there mostly because they're dumps of existing projects. (I'm not sure this is a good reason, but well that's the history)

Comment on lines +1 to +13
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"printWidth": 250,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "es5",
"useTabs": false,
"plugins": ["prettier-plugin-tailwindcss"]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use the project-wide prettier configuration
(should be changed soon finally)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if you want to do it after #371 that's fine by me too.

@@ -0,0 +1,74 @@
export default [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use the project-wide eslint configuration

"dev:rollup": "rollup --config rollup.config.js --watch",
"dev:serve": "web-dev-server --watch",
"lint:check": "eslint **/*.{js,mjs,jsx,ts,tsx}",
"lint:fix": "eslint \"**/*.{js,mjs,jsx,ts,tsx}\" --fix",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
"lint:fix": "eslint \"**/*.{js,mjs,jsx,ts,tsx}\" --fix",
"lint:fix": "npm lint:check -- --fix",

Comment on lines +50 to +51
const breakpoint = breakpoints.find((bp) => width >= bp.minWidth);
this.visibleButtons = breakpoint ? this.buttons.slice(0, breakpoint.buttons) : this.buttons.slice(0, 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, why it's not done with CSS or window.matchMedia?
Is it just to exercize ResizeObserver?
Can we please have a comment to explain that? (also in the other file where it's used)

querySelector(selector, path = []) {
const lookupStartNode = this._frame.contentDocument;
querySelector(selector, path = [], inIframe = false) {
const lookupStartNode = inIframe ? this._frame.contentDocument : this._frame.contentDocument;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2 parts of the ternary are identical, is that expected?


widths.forEach((width) => {
iframeElement.setWidth(`${width}px`);
page.layout();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the layout doesn't work, possibly because the resize observer is async?
I think you should try doing several steps instead of just one, so that the async part is properly captured.

const widths = [560, 640, 704, 768, 800];

widths.forEach((width) => {
iframeElement.setWidth(`${width}px`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants