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

tgui v4.4: More performance improvements #79943

Closed
wants to merge 6 commits into from

Conversation

jlsnow301
Copy link
Contributor

@jlsnow301 jlsnow301 commented Nov 26, 2023

About The Pull Request

Consider this a much more intensive version of #79916. We're pretty limited by the speed of babel-loader, and this PR would completely replace it (with Rust!). Doing so removes the need for a minimizer, but it comes with drawbacks.

  1. We have to switch to using the node_modules folder
  2. IE8 target does not play well, so I'm dropping support (this should affect precisely no one)
Test environment / My specs

intel i7-13700kf
32GB RAM
windows 11
intel 660p m.2 SSD
asus 4080 TUF series

Fresh build

Test steps:

  1. Delete tgui/.yarn/webpack folder
  2. CTRL SHIFT B

Results:
fresh

terser averages 25.16s
swc averages 16.65s - 33.82% faster

Cached build

(assuming files are already there, CTRL SHIFT B if not)

  1. add a comment to an interface file
  2. CTRL SHIFT B

Results:
cached

terser averages 9s
swc averages 2.73s - 69.65% faster

The resulting tgui build speed is faster than both #79916 and certainly our current babel/terser solution.

Why It's Good For The Game

Improved build speed, faster dev tools

Changelog

N/A nothing player facing

@tgstation-server tgstation-server added the UI We make the game less playable, but with round edges label Nov 26, 2023
@jlsnow301 jlsnow301 added Performance Uses the 32-bit address space and slow interpreter more effectively Dependencies What do you mean the node modules folder is 50,000 deep labels Nov 26, 2023
@MrStonedOne
Copy link
Member

this branch uses 2.2gb peak memory usage to clean compile the tgui target.

the npm-updates branch used 1.8gb peak memory usage to clean compile the tgui target, and spent much less time at peak. This mostly matches with that the servers normally expect

the esbuild-plugin branch used 0.9gb peak memory usage to clean compile the tgui target.

Memory usage in prod matters because we almost always have some reason why page/swap/vertical ram has to be disabled, from both k8s and zfs hating it on linux to windows being stupid with it to byond's memory access patterns not meshing well with it to just pure disk iops budget concerns.

Food for thoughts.

@jlsnow301
Copy link
Contributor Author

Food for thoughts.

If we used esbuild instead (which I'm not against), I'd like to still remove ie8 support from the esbuild branch, similar to this. It might even run faster as a result. Any objections to this?

@stylemistake
Copy link
Member

I have no objections to remove IE8 support and fully target IE11.

Regarding node_modules: esbuild supports yarn pnp natively, evanw/esbuild#2451.

Inferno only has a plugin for Babel, so I see no other option but to keep it just for transforming JSX, and esbuild would do the rest.

@optimumtact
Copy link
Member

Memory is already under pressure when there are like 5 keyholders inactive accounts logged in.

@jlsnow301
Copy link
Contributor Author

Regarding node_modules: esbuild supports yarn pnp natively, evanw/esbuild#2451.

I wonder if the higher memory usage is because we have to use the default node modules folder vs yarn's package management system. It doesn't make sense to me that swc would have higher memory usage than esbuild AND babel/terser

@jlsnow301 jlsnow301 closed this Nov 26, 2023
This was referenced Nov 27, 2023
Mothblocks pushed a commit that referenced this pull request Nov 28, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
NaakaKo pushed a commit to Bird-Lounge/Skyraptor-SS13 that referenced this pull request Nov 28, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
SkyratBot pushed a commit to Skyrat-SS13/Skyrat-tg that referenced this pull request Nov 28, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
vinylspiders pushed a commit to Skyrat-SS13/Skyrat-tg that referenced this pull request Nov 28, 2023
* Drops ie8 support (#79974)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Drops ie8 support

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Iajret pushed a commit to Fluffy-Frontier/FluffySTG that referenced this pull request Nov 28, 2023
* Drops ie8 support (#79974)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Drops ie8 support

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
lessthnthree pushed a commit to effigy-se/effigy-se that referenced this pull request Nov 29, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
Jolly-66 added a commit to TaleStation/TaleStation that referenced this pull request Nov 29, 2023
Original PR: tgstation/tgstation#79974
-----

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)
## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
## Changelog
N/A if they can even see this message it doesn't affect them

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: Jolly-66 <70232195+Jolly-66@users.noreply.github.com>
vvvv-vvvv pushed a commit to vvvv-vvvv/TerraGov-Marine-Corps that referenced this pull request Dec 9, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation/tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

(cherry picked from commit 60cf2629e5fee3cfa66ae1aefde191edb4675d3a)
Higgin pushed a commit to Higgin/tgstation that referenced this pull request Dec 12, 2023
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
We currently transpile TGUI down into ie8. This was primarily for Linux
compatibility, which, to my understanding, hasn't worked for quite some
time. As we approach 2024, consider that ie8 is nearly 15 years old and
had its support ended in 2016. I believe sunsetting ie8 is in order.

>I have no objections to remove IE8 support and fully target IE11.

tgstation#79943 (comment)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
- Probably improves performance to some degree, you're only as slow as
your weakest link.
- Reduced maintenance burden
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

N/A if they can even see this message it doesn't affect them

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
Mothblocks pushed a commit that referenced this pull request Dec 15, 2023
## About The Pull Request
Revival of #79943. I was not done with Babel. For some reason, swc was
running very high memory. It was the minifier. If we use our current,
only swapping out babel (the previous PR swapped the minifier AND
transpiler), we not only keep the memory usage down to current levels
but we **slash** TGUI build times. Look at these numbers!

<details>
<summary>Test environment / My specs</summary>

intel i7-13700kf 
32GB RAM
windows 11 
intel 660p m.2 SSD
asus 4080 TUF series

</details>

<details>
<summary>Benchmarks</summary>

### To perform these tests, build/install/compile once, then delete
everything in the tgui/.yarn/webpack folder and all files in tgui/public
**EXCEPT** tgui.html and tgui-polyfill.min.js

Babel is our CURRENT.

Build time 

![2](https://github.com/tgstation/tgstation/assets/42397676/05324a54-2230-4173-a443-ef2aaa82e034)
SWC is 64.36% faster than our current solution

Peak memory usage

![1](https://github.com/tgstation/tgstation/assets/42397676/ab84a91d-7e48-43f8-be1b-7b7b9b36f30a)

</details>

What's the catch? Do we need to use node_modules now? No!

## Why It's Good For The Game
Faster build tools!
## Changelog
N/A nothing player facing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies What do you mean the node modules folder is 50,000 deep Performance Uses the 32-bit address space and slow interpreter more effectively UI We make the game less playable, but with round edges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants