Skip to content

Complex DOM versions of todoMVCs - #264

Merged
issackjohn merged 12 commits into
WebKit:mainfrom
lpardosixtosMs:issackjohn/ComplexDOMVersionsOfTodoMVC
Jul 13, 2023
Merged

Complex DOM versions of todoMVCs#264
issackjohn merged 12 commits into
WebKit:mainfrom
lpardosixtosMs:issackjohn/ComplexDOMVersionsOfTodoMVC

Conversation

@issackjohn

@issackjohn issackjohn commented Jun 29, 2023

Copy link
Copy Markdown
Contributor

The source components were moved without any modifications. A minor change was made to the Vue structure to match the expected structure of generated.css.

This pull request includes the following changes:

  • Complex DOM versions now use a buildComplex.js script from the big-dom-generator package to build their distributions.
  • The script works by taking the output files from the standalone version's dist folder and making any necessary changes, including copying over two CSS files and one logo.png. One CSS file is for the styling of the surrounding complex app, while the other is generated.css, which contains matching and non-matching CSS rules.
  • It updates the dist folder path for the react complex version in test suites.
  • It moves complex-static-html out of tentative and renames to it big-dom-generator.
    • removed react todomvc that was in this folder.
  • It adds big-dom-generator as a dependency to complex versions using npm link big-dom-generator.

Affected:

  • angular
  • backbone
  • jquery
  • preact
  • react
  • react-redux
  • svelte
  • vue
  • javascript-es5
  • javascript-es6
  • javascript-es6-webpack

There will be a follow up PR which adds the test suites for these Complex DOM versions.

- complex, shared, standalone folders for each TodoMVC in our affected list.
angular has projects/standalone, projects/complex, projects/shared-library

  • It allows TodoMVCs to reuse components between standalone and complex versions.
  • some index.html files were separated into index.html and partial.html so both standalone & complex can make use of the same files when building.
    • complex builds will take the body of big-dom-generator/dist/index.html, inject partial.html into it as
    .replace('<div class="todo-area">', `<div class="todo-area"><div class="todoholder">${partial.html}</div>`)

and then inject this resulting string into the body of index.html.

@issackjohn
issackjohn marked this pull request as ready for review June 29, 2023 20:53
@issackjohn issackjohn added the major change A change with major implications on benchmark results or affect governance policy label Jun 29, 2023
@issackjohn issackjohn assigned issackjohn and unassigned issackjohn Jun 29, 2023
@issackjohn

Copy link
Copy Markdown
Contributor Author

@lpardosixtosMs I'm not able to add you as a reviewer so could you please join when you get the chance?

@issackjohn
issackjohn requested a review from rniwa June 29, 2023 22:12
@rniwa

rniwa commented Jun 30, 2023

Copy link
Copy Markdown
Member

I don't think this is a "major change" given that it's not gonna affect the score. The PR which modifies tests.mjs to include complex DOM should be labeled a major change instead.

Chrome

  • Before

    • 48.9 ± 1.3
    • 49.3 ± 1.4
    • 48.3 ± 1.4
  • After

    • 49.1 ± 0.65
    • 48.6 ± 1.6
    • 49.6 ± 1.0

Firefox

  • Before

    • 37.7 ± 1.3
    • 37.8 ± 1.2
    • 37.6 ± 1.3
  • After

    • 37.2 ± 1.3
    • 37.8 ± 1.1
    • 37.9 ± 1.2

Safari

  • Before

    • 40.2 ± 0.49
    • 40.9 ± 1.4
    • 40.3 ± 0.69
  • After

    • 41.8 ± 0.96
    • 41.2 ± 1.1
    • 40.7 ± 0.87

complex-dom.zip

@issackjohn issackjohn removed the major change A change with major implications on benchmark results or affect governance policy label Jun 30, 2023
@rniwa rniwa added the non-trivial change A change that affects benchmark results label Jun 30, 2023
issackjohn and others added 3 commits July 3, 2023 12:23
Restructured TodoMVC to share resources between standalone and complex versions.
---------

Co-authored-by: lpardosixtosMs <94007365+lpardosixtosMs@users.noreply.github.com>
Co-authored-by: Luis Fernando Pardo Sixtos <lpardosixtos@microsoft.com>
* del tenative/complex-static-html from .gitignore
* tentative/complex-static-html removed.
* restore missing png
* update big-dom-generator readme and build scripts
* generated css now doesn't upset formatter
* building everything again just in case.
@issackjohn
issackjohn force-pushed the issackjohn/ComplexDOMVersionsOfTodoMVC branch from a38d196 to 5a812e6 Compare July 3, 2023 19:23
Rebuild react-redux dist and remove unused files.
 rebuild angular complex dist with new generated css

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this huge work, I believe this will be a very good addition to the benchmark.

I left a few comments for some problems I noticed, or just improvements, tell me what you think!

The only workload I don't understand fully is Angular, I'm not familiar with it and it's very different to the other frameworks. Would you please explain this a bit more? Why is it constructed so differently than the others?

Thanks!

Comment thread resources/todomvc/architecture-examples/angular/gulpfile.js Outdated
Comment thread resources/todomvc/big-dom-generator/README.md Outdated
Comment thread resources/todomvc/big-dom-generator/README.md Outdated
Comment thread resources/todomvc/big-dom-generator/generated.css Outdated
Comment thread resources/todomvc/architecture-examples/backbone/standalone/scripts/build.js Outdated
Comment thread resources/todomvc/architecture-examples/backbone/complex/scripts/build.js Outdated
Comment thread resources/todomvc/architecture-examples/angular/package.json Outdated
Comment thread resources/todomvc/architecture-examples/angular/package.json Outdated
Comment thread resources/todomvc/architecture-examples/angular/projects/complex/src/index.html Outdated
@issackjohn

issackjohn commented Jul 5, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for this huge work, I believe this will be a very good addition to the benchmark.

I left a few comments for some problems I noticed, or just improvements, tell me what you think!

The only workload I don't understand fully is Angular, I'm not familiar with it and it's very different to the other frameworks. Would you please explain this a bit more? Why is it constructed so differently than the others?

Thanks!

Thank you for taking the time to review!

I am also not familiar with Angular, but I'll do my best to explain my understanding of it.

A project is a set of files that comprise a standalone application or a shareable library. In the other projects I separated out shared components between the complex and standalone versions to a shared folder. For angular though, I went with this structure.

There is another way to do this, with a shared module. I went with the library approach, but I'm not 100% sure that's the best solution. IIUC, the only difference is that a library can be distributed as an npm package. If someone with more Angular background could weigh in that would be helpful and I'm happy to make the required changes.

structure of output

The default output of angular applications with multiple projects in them is:

dist /
  project-one/
  project-two/
  shared-library/

If we like this structure better, we can change it to that instead of

projects/
  project-one/
    dist/
  project/-two/
    dist/
  shared-library/
    dist/

@rniwa

rniwa commented Jul 6, 2023

Copy link
Copy Markdown
Member

What's the next step for this PR?

@flashdesignory

Copy link
Copy Markdown
Contributor

What's the next step for this PR?

I think once the requested changes from @julienw are done, we can review again

@issackjohn

Copy link
Copy Markdown
Contributor Author

What's the next step for this PR?

I think once the requested changes from @julienw are done, we can review again

Yes, I'm currently working on the requested changes.

Part 1 of addressing PR comments

@flashdesignory flashdesignory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we changing the directory structure of the standalone versions?
My understanding was that the css changes that were previously discussed is all that's needed. We should NOT alter the directory structure and split files into complex / shared / standalone. Whatever the complex wrapper is doing needs to be independent, outside of the original todomvc apps.

It was my understanding that the standalone apps generate output files in the dist folder that can be consumed by the complex wrapper app.

@flashdesignory

Copy link
Copy Markdown
Contributor

Here is an example that's acceptable for the folder structure:
Everything in the standalone version should remain the same as it is now in "main" after the css updates that were already merged.

Screenshot 2023-07-05 at 9 50 53 PM

Comment thread resources/todomvc/vanilla-examples/javascript-es5/complex/scripts/build.js Outdated
@lpardosixtosMs

Copy link
Copy Markdown
Contributor

Why are we changing the directory structure of the standalone versions? My understanding was that the css changes that were previously discussed is all that's needed. We should NOT alter the directory structure and split files into complex / shared / standalone. Whatever the complex wrapper is doing needs to be independent, outside of the original todomvc apps.

It was my understanding that the standalone apps generate output files in the dist folder that can be consumed by the complex wrapper app.

@flashdesignory I'm not sure how to do this just by working over the standalone dist folder, I can imagine it working for simple bundles like react/javascript-es5 but I'll let @issackjohn comment on the others if needed. It also seems unrealistic to add and modify the already bundled files. What we can do is go back to the old folder structure and let the complex version temporarily copy or point to the standalone sources and build the whole app just like it is doing right now, WDYT?

@flashdesignory

Copy link
Copy Markdown
Contributor

@issackjohn - thanks for making all these changes. I know that was a lot of work.
I took a quick look and overall it looks a lot cleaner and simpler and I like the idea of the local installs for the todomvc apps 🎉 .

I'll review on Monday though since there's a lot to go through!

@flashdesignory flashdesignory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me - a huge change from before.
let's wait for @julienw to review as well!

"serve": "http-server ./dist -p 7002 -c-1 --cors"
},
"devDependencies": {
"angular": "file:../angular",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: that's something we didn't think about when naming the todomvc standalone apps.
Looks weird now when installing the local todo app - what do you all think? should we rename all the standalone versions to be explicit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it could be something like:

todomvc-angular
todomvc-angular-complex

todomvc-es5
todomvc-es5-complex

what do you think @julienw @issackjohn ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SGTM. There aren't plans to publish these packages to npm right? I see todomvc-react already published there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no plans to publish to npm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That said, I wonder why we have to install them instead of refering to the source files directly in build.js. It seems to me that this is an unneeded indirection. What do you think? Is there a reason I'm not seeing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also the build scripts rely on the fact that the standalone versions have been built with their latest source. I'm not sure we should assume this, and instead we could run npm i && npm run build on the related standalone version first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

using a local install vs just pointing to the local folder doesn't bother me. I think that's consistent with the way we use the todo-css and news-css folders currently.

Regarding running the build script before, I think that's an option to force a rebuild before... there are probably reasons for either way. It would be nice if we'd be using pnpm, cause then we could install a local package by version 🤷

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It makes sense for the other cases because we're using import or require on them (as far as I remember), but here we're merely copying the files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it could be something like:

todomvc-angular
todomvc-angular-complex

todomvc-es5
todomvc-es5-complex

what do you think @julienw @issackjohn ?

sounds good to me

Done.

Comment thread resources/todomvc/architecture-examples/backbone/scripts/build.js
Comment thread resources/todomvc/architecture-examples/jquery/package.json
@issackjohn

Copy link
Copy Markdown
Contributor Author

@issackjohn - thanks for making all these changes. I know that was a lot of work. I took a quick look and overall it looks a lot cleaner and simpler and I like the idea of the local installs for the todomvc apps 🎉 .

I'll review on Monday though since there's a lot to go through!

@flashdesignory Thank you for your review! There was a lot to go through & I appreciate you taking the time. 🎉

Comment thread resources/todomvc/architecture-examples/preact-complex/package.json
Comment thread resources/todomvc/architecture-examples/svelte/dist/index.html Outdated
Comment thread resources/todomvc/big-dom-generator/params.js
Comment thread resources/todomvc/big-dom-generator/index.js Outdated
Comment thread resources/todomvc/big-dom-generator/utils/buildComplex.js Outdated
Comment thread resources/todomvc/big-dom-generator/utils/buildComplex.js Outdated
Comment thread resources/todomvc/big-dom-generator/utils/buildComplex.js Outdated
@julienw

julienw commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

Sorry I've put individual comments instead of just one review. This looks much simpler than before. I left a few comments, tell me what you think.

* update build scripts
* update package.jsons
* update lock files
* build all dists again
* move css imports to app.jsx
* more verbose build done message
* use sync version of all the tools.
* update readme
@issackjohn

Copy link
Copy Markdown
Contributor Author

Sorry I've put individual comments instead of just one review. This looks much simpler than before. I left a few comments, tell me what you think.

I appreciate you taking the time to review! Thank you.

@issackjohn
issackjohn requested a review from julienw July 11, 2023 19:11
@issackjohn

Copy link
Copy Markdown
Contributor Author

@julienw Are there any outstanding requested changes?

@rniwa rniwa added trivial change A change that doesn't affect benchmark results and removed non-trivial change A change that affects benchmark results labels Jul 12, 2023
@julienw

julienw commented Jul 13, 2023

Copy link
Copy Markdown
Contributor

Please remove javascript-es6-complex and the changes to javascript-es6 as they will be removed in #283, so that there won't be any conflict.

Comment thread resources/todomvc/big-dom-generator/utils/buildComplex.js

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I believe this can go in like this.

For follow-ups (I'm serious: not for this patch!):
My main concern is that just running npm run build in the "complex" directories doesn't work without doing some prerequisites:

  1. npm i in big-dom-generator
  2. npm run build in the standalone directory

I think these dependencies should be run or checked when running the build scripts, or part of npm run build.
It's not clear to me why adding jsdom in the dependencies list (in big-dom-generator) doesn't install it when running npm i in the complex directories, but that may be how filepath-based dependencies work (I'm not too familiar with that).

I think we'll have to fix this issue, but, let me repeat myself, not in this PR :-)

Thanks!

* remove javascript-es6-complex
* revert changes to javascript-es6
@issackjohn
issackjohn merged commit cba2b0d into WebKit:main Jul 13, 2023
@issackjohn

Copy link
Copy Markdown
Contributor Author

Thanks, I believe this can go in like this.

For follow-ups (I'm serious: not for this patch!): My main concern is that just running npm run build in the "complex" directories doesn't work without doing some prerequisites:

  1. npm i in big-dom-generator
  2. npm run build in the standalone directory

I think these dependencies should be run or checked when running the build scripts, or part of npm run build. It's not clear to me why adding jsdom in the dependencies list (in big-dom-generator) doesn't install it when running npm i in the complex directories, but that may be how filepath-based dependencies work (I'm not too familiar with that).

I think we'll have to fix this issue, but, let me repeat myself, not in this PR :-)

Thanks!

Thank you again for your review! This all sounds good to me. I will submit a follow-up PR with the revisions once we land the JavaScript-web-components & Lit complex DOM versions, which are critical for the code freeze.

@issackjohn
issackjohn deleted the issackjohn/ComplexDOMVersionsOfTodoMVC branch July 16, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trivial change A change that doesn't affect benchmark results v3-blocker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants