compression pr #8

Closed
quartinal wants to merge 12 commits from (deleted):main into main-lfs-fix-archive
First-time contributor

When I cloned this repository on my personal computer, I discovered that the WebAssembly files could be compressed downwards by almost 3 times, and the JavaScript files could, with exceptional minification and compression, be simplified with tsup by hundreds, if not thousands, of bytes.

To start this off, I'd recommend merging this into a separate branch and deploying it to somewhere on the "eaglercraft.win" origin (because of the JSPI thing that you guys seemingly already solved).

I didn't mess up any CSS, and yes, I did add a package.json file, but I am not planning on making this with an HTTP framework; the file is there merely for efficiency.

That being said, the package.json file is there for you if it seems you need to compress the JavaScript and WebAssembly files even more than I already did.

NOTE: Compressing the WebAssembly files takes time, and yes, it does complete after around 4-9 minutes.

There's also one very last side note: I simplified the logic for checking if the page is running under the strict file protocol from document.location.href.startsWith('file:') to location.protocol === 'file:' in the large client HTML files.

When I cloned this repository on my personal computer, I discovered that the WebAssembly files could be compressed downwards by almost 3 times, and the JavaScript files could, with exceptional minification and compression, be simplified with [tsup](https://tsup.egoist.dev/) by hundreds, if not thousands, of bytes. To start this off, I'd recommend merging this into a separate branch and deploying it to somewhere on the "eaglercraft.win" origin (because of the JSPI thing that you guys seemingly already solved). I didn't mess up any CSS, and yes, I did add a package.json file, but I am not planning on making this with an HTTP framework; the file is there merely for efficiency. That being said, the package.json file is there for you if it seems you need to compress the JavaScript and WebAssembly files even more than I already did. **NOTE:** Compressing the WebAssembly files takes time, and yes, it does complete after around 4-9 minutes. There's also one very last side note: I simplified the logic for checking if the page is running under the strict file protocol from `document.location.href.startsWith('file:')` to `location.protocol === 'file:'` in the large client HTML files.
quartinal added 1 commit 2025-01-13 12:16:49 -08:00
Owner

aw hell naw jasper found the gitea

aw hell naw jasper found the gitea
PrestonT500 requested review from qwertychomp 2025-01-13 13:08:31 -08:00
PrestonT500 requested review from clashofclanselixircollector 2025-01-13 13:08:31 -08:00
clashofclanselixircollector was assigned by PrestonT500 2025-01-13 13:08:53 -08:00
Owner

do we need to compress it, its only 1gb, just send 1 cmd to config git and done

do we need to compress it, its only 1gb, just send 1 cmd to config git and done
Author
First-time contributor

yes, it may help decrease sudden kickoffs from servers and will generally increase our traffic

yes, it may help decrease sudden kickoffs from servers and will generally increase our traffic
Author
First-time contributor

@Sevi i was fully aware about this a while ago lmao

@Sevi i was fully aware about this a while ago lmao
Member

we can easily get much better speed-ups by just uploading all the eagler files to cloudflare (which ive been planning on doing), and this pr will also make it harder for people to config eagler to add default servers and stuff like that, because the config is part of the js. i don't really see a point in merging this.

we can easily get much better speed-ups by just uploading all the eagler files to cloudflare (which ive been planning on doing), and this pr will also make it harder for people to config eagler to add default servers and stuff like that, because the config is part of the js. i don't really see a point in merging this.
Author
First-time contributor

@qwertychomp, well, the wasm files are the second priority, but bundling the javascript files that power the clients and then changing the <script src="..."></script> to reference the corresponding files in the distribution folder will certainly make this even faster. that being said, i highly support the uploading of the eagler files to cloudflare as it will, combined with the mass optimizing by tsup (which uses esbuild) most likely decrease sudden kickoffs from clients and increase the overall performance. think of the original non-minified eagler javascript files as ultraviolet script files. i think (but i'm not entirely certain) that all the eagler javascript files were bundled by webpack or something, which is already infamous for being complex and not being as fast (in both the bundling time and the javascript file initiation speed in the browser) as esbuild. that being said, the wasm files were compressed by brotli (which is already well-known for being a web compression algorithm that results in faster load times), so i believe they will load faster than they previously did. if not, i'll try using wasm-opt to optimize the files reliably.

with that out of the way, i can also tweak the package.json file to have a script that is accountable for letting the user edit the config in the minified files directly in the terminal with some javascript vim/nvim opener, if that makes more sense, or even on the website if that would be easier for users.

@qwertychomp, well, the wasm files are the second priority, but bundling the javascript files that power the clients and then changing the `<script src="..."></script>` to reference the corresponding files in the distribution folder will certainly make this even faster. that being said, i highly support the uploading of the eagler files to cloudflare as it will, combined with the mass optimizing by tsup (which uses [esbuild](https://github.com/evanw/esbuild)) most likely decrease sudden kickoffs from clients and increase the overall performance. think of the original non-minified eagler javascript files as ultraviolet script files. i think (but i'm not entirely certain) that all the eagler javascript files were bundled by webpack or something, which is already infamous for being complex and not being as fast (in both the bundling time and the javascript file initiation speed in the browser) as esbuild. that being said, the wasm files were compressed by brotli (which is already well-known for being a web compression algorithm that results in faster load times), so i believe they will load faster than they previously did. if not, i'll try using wasm-opt to optimize the files reliably. with that out of the way, i can also tweak the package.json file to have a script that is accountable for letting the user edit the config in the minified files directly in the terminal with some javascript vim/nvim opener, if that makes more sense, or even on the website if that would be easier for users.
Owner

idk about priority, most people use wasm its faster but all of them are wanted

idk about priority, most people use wasm its faster but all of them are wanted
Owner

also @qwertychomp wdym upload to cloudflare, we are not using pages

also @qwertychomp wdym upload to cloudflare, we are not using pages
PrestonT500 started working 2025-01-13 19:29:10 -08:00
PrestonT500 worked for 4 seconds 2025-01-13 19:29:14 -08:00
PrestonT500 started working 2025-01-13 19:29:28 -08:00
PrestonT500 canceled time tracking 2025-01-13 19:29:31 -08:00
PrestonT500 started working 2025-01-13 19:29:35 -08:00
Owner

@quartinal you could try doing this on your fork then we will see when u got it and working

@quartinal you could try doing this on your fork then we will see when u got it and working
PrestonT500 worked for 1 minute 53 seconds 2025-01-13 19:31:28 -08:00
Author
First-time contributor

@PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself

@PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself
quartinal added 1 commit 2025-01-14 07:55:20 -08:00
quartinal added 1 commit 2025-01-14 07:59:17 -08:00
quartinal added 1 commit 2025-01-14 08:02:00 -08:00
quartinal added 1 commit 2025-01-14 08:47:50 -08:00
Member

preston i mean upload the eagler files to cloudflare cdn

preston i mean upload the eagler files to cloudflare cdn
Member
@PrestonT500
quartinal added 1 commit 2025-01-14 13:15:13 -08:00
quartinal added 1 commit 2025-01-14 14:02:52 -08:00
PrestonT500 started working 2025-01-14 20:07:52 -08:00
Owner

@quartinal the discord popup is on purpose so people know about our server. Also they can just click cancel or our don't show again checkbox that does work. clashofclanselixircollector might deny cuz of this, they are assigned

@quartinal the discord popup is on purpose so people know about our server. Also they can just click cancel or our don't show again checkbox that does work. clashofclanselixircollector might deny cuz of this, they are assigned
PrestonT500 worked for 1 minute 20 seconds 2025-01-14 20:09:12 -08:00
PrestonT500 started working 2025-01-15 07:33:00 -08:00
Owner

@PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself

The repo is the same size, I meant try it compressed.

Edit: Actually your repo is bigger than ours

> @PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself The repo is the same size, I meant try it compressed. Edit: Actually your repo is bigger than ours
PrestonT500 worked for 36 seconds 2025-01-15 07:33:36 -08:00
PrestonT500 started working 2025-01-15 07:33:59 -08:00
PrestonT500 worked for 22 seconds 2025-01-15 07:34:21 -08:00
Author
First-time contributor

@PrestonT500 why do we need the discord popup when there is a discord join button right below it that users will see on page load? but if it's actually needed for more attention or something, i can just add a prompt(...) yes/no/dsa (don't show again) function (much easier to reliably develop than an html/css/js popup) that executes on page load unless otherwise specified in a localstorage key.

also a potential reason why my repo is bigger is because of the added files. and even if that's not the case, that doesn't mean the files won't run faster. but even that's not the overall point of this pr. the main point was just to simplify the code.

i still have some work to do on the css files.

@PrestonT500 why do we need the discord popup when there is a discord join button right below it that users will see on page load? but if it's actually needed for more attention or something, i can just add a `prompt(...)` yes/no/dsa (don't show again) function (much easier to reliably develop than an html/css/js popup) that executes on page load unless otherwise specified in a localstorage key. also a potential reason why my repo is bigger is because of the added files. and even if that's not the case, that doesn't mean the files won't run faster. but even that's not the overall point of this pr. the main point was just to simplify the code. i still have some work to do on the css files.
Owner

@PrestonT500 why do we need the discord popup when there is a discord join button right below it that users will see on page load? but if it's actually needed for more attention or something, i can just add a prompt(...) yes/no/dsa (don't show again) function (much easier to reliably develop than an html/css/js popup) that executes on page load unless otherwise specified in a localstorage key.

also a potential reason why my repo is bigger is because of the added files. and even if that's not the case, that doesn't mean the files won't run faster. but even that's not the overall point of this pr. the main point was just to simplify the code.

i still have some work to do on the css files.

@quartinal we already made it so "easier" doesnt matter, anyway its up to @clashofclanselixircollector

> @PrestonT500 why do we need the discord popup when there is a discord join button right below it that users will see on page load? but if it's actually needed for more attention or something, i can just add a `prompt(...)` yes/no/dsa (don't show again) function (much easier to reliably develop than an html/css/js popup) that executes on page load unless otherwise specified in a localstorage key. > > also a potential reason why my repo is bigger is because of the added files. and even if that's not the case, that doesn't mean the files won't run faster. but even that's not the overall point of this pr. the main point was just to simplify the code. > > i still have some work to do on the css files. @quartinal we already made it so "easier" doesnt matter, anyway its up to @clashofclanselixircollector
Owner

@PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself

The repo is the same size, I meant try it compressed.

Edit: Actually your repo is bigger than ours

@quartinal did you try it compressed yet

> > @PrestonT500, visit https://eaglercraft-xi.vercel.app and check out my fork for yourself > > The repo is the same size, I meant try it compressed. > > Edit: Actually your repo is bigger than ours @quartinal did you try it compressed yet
Author
First-time contributor

yes, i'm also trying to use @espcom/esbuild-plugin-compress with tsup to compress the .js files to .js.br files which ultimately are faster with brotli compression and smaller.

yes, i'm also trying to use `@espcom/esbuild-plugin-compress` with tsup to compress the .js files to .js.br files which ultimately are faster with brotli compression and smaller.
Owner

yes, i'm also trying to use @espcom/esbuild-plugin-compress with tsup to compress the .js files to .js.br files which ultimately are faster with brotli compression and smaller.

@quartinal ok when you're done push it so i can see it

> yes, i'm also trying to use `@espcom/esbuild-plugin-compress` with tsup to compress the .js files to .js.br files which ultimately are faster with brotli compression and smaller. @quartinal ok when you're done push it so i can see it
PrestonT500 requested review from PrestonT500 2025-01-17 11:38:34 -08:00
PrestonT500 refused to review 2025-01-17 11:38:49 -08:00
PrestonT500 removed review request for clashofclanselixircollector 2025-01-17 11:39:02 -08:00
quartinal added 1 commit 2025-01-19 06:59:59 -08:00
quartinal added 1 commit 2025-01-19 16:57:00 -08:00
i re-did the transitions, used fuse.js for client fuzzy searching, and added some more useful features
quartinal added 1 commit 2025-01-21 19:21:01 -08:00
quartinal added 1 commit 2025-01-21 20:03:05 -08:00
Owner

@quartinal how much do you think this could compress our repository. Also you might want to fix the conflicting changes. And we are using LFS now if that matters.

@quartinal how much do you think this could compress our repository. Also you might want to fix the conflicting changes. And we are using LFS now if that matters.
PrestonT500 requested review from PrestonT500 2025-01-22 20:22:25 -08:00
Author
First-time contributor

it definitely could compress our repository by many kilobytes, as esbuild not only compresses, but simplifies long functions and statements, which ultimately improves the overall load time and contentful paint. but that's not all I was aiming for with this pr. I was also aiming for simplifying the code and adding some features that will generally improve the overall user experience both on the homepage and playing the game.

also, by lfs do you mean large file storage? because that doesn't really matter in my opinion and in the context of what I was aiming for with this pr.

also, could you resolve the merge conflicts in a separate branch and then merge this pr into that instead of the main?

it definitely could compress our repository by many kilobytes, as esbuild not only compresses, but simplifies long functions and statements, which ultimately improves the overall load time and contentful paint. but that's not all I was aiming for with this pr. I was also aiming for simplifying the code and adding some features that will generally improve the overall user experience both on the homepage and playing the game. also, by lfs do you mean large file storage? because that doesn't really matter in my opinion and in the context of what I was aiming for with this pr. also, could you resolve the merge conflicts in a separate branch and then merge this pr into that instead of the main?
quartinal added 1 commit 2025-01-25 17:28:49 -08:00
Author
First-time contributor

nvm, i'm just gonna create a new pull request lol.

nvm, i'm just gonna create a new pull request lol.
quartinal closed this pull request 2025-02-03 19:15:36 -08:00

Pull request closed

Sign in to join this conversation.
No Label
No Milestone
No project
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: EaglercraftX-Client-Collections/EaglercraftX-Site#8
No description provided.