Skip to content
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

Extras merged into engine #6228

Merged
merged 21 commits into from
Apr 15, 2024
Merged

Extras merged into engine #6228

merged 21 commits into from
Apr 15, 2024

Conversation

kpal81xd
Copy link
Contributor

@kpal81xd kpal81xd commented Apr 8, 2024

  • Adds extras to engine source (paths all relative now)
  • Remaps pcx to pc in UMD build (legacy support)
  • Removes adding extras to examples (examples includes extras types

N.B

  • fflate now included in build

File sizes

  • playcanvas.min.js 1.6MB -> 1.7MB
  • playcanvas.min.mjs 1.5MB -> 1.6MB
  • playcanvas.dbg.js 17.1MB -> 18.1MB
  • playcanvas.dbg.mjs 15.1MB -> 15.8MB
  • playcanvas.prf.js 2.9MB -> 3MB
  • playcanvas.prf.mjs 2.5MB -> 2.6MB
  • playcanvas.js 2.9MB -> 3MB
  • playcanvas.mjs 2.5MB -> 2.6MB
  • gzip 12.7MB -> 13.3MB (N.B. includes unbundled ESM builds)

TODO

  • handle backwards compatibility in editor

@kpal81xd kpal81xd requested a review from a team April 8, 2024 16:46
@kpal81xd kpal81xd self-assigned this Apr 8, 2024
@mvaligursky
Copy link
Contributor

What's the size impact for the UMD build, especially minified, and also gzipped version of it.

@mvaligursky
Copy link
Contributor

Also, should we add @category tags for the API docs to be well organized?

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Apr 8, 2024

Also, should we add @category tags for the API docs to be well organized?

Like extras category on top of the existing categories?

@mvaligursky
Copy link
Contributor

Also, should we add @category tags for the API docs to be well organized?

Like extras category on top of the existing categories?

Not sure what would be the best. Maybe even Exporters, Gizmo, RenderPasses and similar? What do you think @willeastcott ?

@willeastcott
Copy link
Contributor

I think RenderPasses should be under Graphics. But the rest is fine.

@mvaligursky
Copy link
Contributor

Would you have this in kB? I'd like to see if this is 10k or more like a 100k difference, which is hard to see with the rounding:
playcanvas.min.js 1.6MB -> 1.7MB

Also, this specific target only gzip comparison as well please.

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Apr 9, 2024

Would you have this in kB? I'd like to see if this is 10k or more like a 100k difference, which is hard to see with the rounding: playcanvas.min.js 1.6MB -> 1.7MB

Also, this specific target only gzip comparison as well please.

playcanvas.min.js 1616650B -> 1709861B
playcanvas.min.js (gzip) 406757B -> 433084B

@marklundin
Copy link
Member

Are extras only added to the UMD build or ESM too?

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Apr 9, 2024

Are extras only added to the UMD build or ESM too?

Both

@slimbuck
Copy link
Member

slimbuck commented Apr 9, 2024

I can't remember now, what are the reasons behind this change? We use fflate only when exporting usdz models. Adding all this to the core engine seems... wrong.

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Apr 9, 2024

I can't remember now, what are the reasons behind this change? We use fflate only when exporting usdz models. Adding all this to the core engine seems... wrong.

Simplifies out entire build process, also allows extras to work properly with the standalone engine and will include the extras types too

@mvaligursky
Copy link
Contributor

The end goal is to use ESM build everywhere and tree-shaking, so the size increase won't be a problem longer term.
The question is if we're ok with this till then. Gzipped minified build is 26k larger, which is an increase of 6.4%. To me this is acceptable, 26k is a small cost to pay temporarily.

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Apr 9, 2024

The end goal is to use ESM build everywhere and tree-shaking, so the size increase won't be a problem longer term. The question is if we're ok with this till then. Gzipped minified build is 26k larger, which is an increase of 6.4%. To me this is acceptable, 26k is a small cost to pay temporarily.

So is this good to merge or does it need more discussion?

@marklundin
Copy link
Member

I know this is largely semantics, but should the extras not live inside src if we're folding it into the engine?

@mvaligursky
Copy link
Contributor

I know this is largely semantics, but should the extras not live inside src if we're folding it into the engine?

yep, notice the renames, for example:
extras/mini-stats/mini-stats.js → src/extras/mini-stats/mini-stats.js

@mvaligursky
Copy link
Contributor

Note that before the engine with this change is released, we need to release the Editor to handle the lack of extras, in a backwards compatible way.

Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

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

Looks great!

@kpal81xd kpal81xd merged commit 024e091 into main Apr 15, 2024
7 checks passed
@kpal81xd kpal81xd deleted the extras-merge branch April 15, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants