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

reduce php binary to minimum #7

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

reduce php binary to minimum #7

wants to merge 1 commit into from

Conversation

soyuka
Copy link
Owner

@soyuka soyuka commented Oct 16, 2024

Clone this branch, then run:

docker buildx bake
cp build/* ../phpdoc/web-php/js

@@ -40,7 +40,7 @@ WORKDIR /src/sqlite
RUN emcc -Oz -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_NORMALIZE -c sqlite3.c -o sqlite3.o

FROM build_tool as php_src
ARG PHP_BRANCH=PHP-8.3.0
ARG PHP_BRANCH=PHP-8.4.0
Copy link

Choose a reason for hiding this comment

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

Suggested change
ARG PHP_BRANCH=PHP-8.4.0
ARG PHP_BRANCH=PHP-8.4

(It would be even better to use the latest tag).

@dunglas
Copy link

dunglas commented Oct 16, 2024

You could likely reduce the size more by compressing the final file using these tricks: https://rustwasm.github.io/book/reference/code-size.html

@soyuka
Copy link
Owner Author

soyuka commented Oct 16, 2024

actually everything is built-in emcc: https://emscripten.org/docs/optimizing/Optimizing-Code.html#how-to-optimize-code and I found -O2 to be the most optimized when it comes to building PHP. The thing we need to do is serve the .wasm gzipped.

Also emcc already uses wasm-opt.

@drupol
Copy link

drupol commented Dec 10, 2024

I'm interested to build this reproducibly with Nix!

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.

3 participants