Skip to content

Add a Best Practices section to the website. NFC - #27334

Open
sbc100 wants to merge 4 commits into
emscripten-core:mainfrom
sbc100:best_practices
Open

Add a Best Practices section to the website. NFC#27334
sbc100 wants to merge 4 commits into
emscripten-core:mainfrom
sbc100:best_practices

Conversation

@sbc100

@sbc100 sbc100 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

I've been working on this as part of the https://developer.chrome.com/docs/modern-web-guidance project and it seems like whatever we do there it makes sense to maintain best practices guide directly in emscripten.

@sbc100
sbc100 force-pushed the best_practices branch 3 times, most recently from 7d2220d to 7052085 Compare July 13, 2026 20:30
@sbc100
sbc100 requested review from dschuff and kripken July 13, 2026 20:30
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
@sbc100
sbc100 force-pushed the best_practices branch 3 times, most recently from f9da982 to 407b7ab Compare July 14, 2026 18:35

@dschuff dschuff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oops, I forgot to hit send yesterday.

Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Feedback addressed

Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
@sbc100
sbc100 force-pushed the best_practices branch 2 times, most recently from a282780 to b759f99 Compare August 25, 2026 19:44
@sbc100
sbc100 requested a review from kripken August 25, 2026 20:03
@sbc100
sbc100 requested review from dschuff and hoodmane August 25, 2026 20:03
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
- **Don't include the "=1" suffix for boolean flags.** For example, write
``-sSTRICT`` and ``-sALLOW_MEMORY_GROWTH`` rather than ``-sSTRICT=1`` or
``-sALLOW_MEMORY_GROWTH=1``.
- **Use separate compilation** by compiling ``.cpp`` sources to ``.o`` object

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would put all the things before this in a "lint" section. Separate compilation and C++/JS interop feel like substantially different things, choices about the build system and design.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've called this section "Command-Line Style" .. I also considered "Command line hygene"

Comment thread site/source/docs/compiling/best_practices.rst
Comment thread site/source/docs/compiling/best_practices.rst
Comment thread site/source/docs/compiling/best_practices.rst Outdated
Comment thread site/source/docs/compiling/best_practices.rst Outdated
- For small temporary files, ``MEMFS`` is sufficient.
- For persistent client-side data storage across browser sessions, use
asynchronous storage backends such as :ref:`filesystem-api-idbfs` or the
:ref:`Filesystem-API`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps just link to the main filesystem page for filesystem recommendations? This could also summarize that page, if we want that (if so, perhaps mention WasmFS).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that makes sense. Linked to wider docs on FS

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I removed this section for now

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.

4 participants