What are the benefits of decreasing the stack size to 1Mb? If I understand correctly, the reduced binary size only happens if the stack size is 64K or less.
On Thu, 20 May 2021 at 01:44, 'Sam Clegg' via emscripten-discuss < emscripten-discuss@googlegroups.com> wrote: > > > On Wed, May 19, 2021 at 9:23 AM Floh <flo...@gmail.com> wrote: > >> > Btw, Floh in that code snippet, it would be good to change the >> > 'vertices' and 'indices' arrays to be 'const' so that the compiler >> > will have an easy time to avoid placing them on the stack... >> >> Does the compiler actually this sort of magic with const? I was only aware >> of static. But yes, real world code wouldn't place such data on the stack. >> >> In the samples I just wanted to make clear (and also test) that the >> initialization >> data doesn't need to stick around for the lifetime of the buffer, instead >> it is >> copied into the buffer (or image) inside the sg_make_xxx calls. >> >> As for 64 KByte as default, I'm a bit divided. On one hand I agree with >> you guys that it's better to have a small default which breaks early >> instead of a big default >> which wastes memory for 99% of projects. On the other hand, >> platform-specific >> compiler/linker options are a bit of a hassle in cross-platform build >> scripts. >> >> I'd prefer a "useful default" which is "good enough" for many projects. >> E.g. I can already >> see the "flood" of issues asking why the code using my libraries causes >> errors >> in WASM even though they did everything "exactly like in the sample code" >> ;) >> >> (after all, it looks like the default initial memory is 16 MBytes, and 64 >> KBytes of >> 16 MBytes is just 0.4% (if my math is right), IMHO a bit more "waste" for >> the stack >> would be acceptable) >> > > Sounds like you would be more amenable to what my PR is currently doing > which is reducing to 1Mb? > > >> >> Cheers! >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to emscripten-discuss+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/71303cf3-2d27-4dfa-b17c-bf000edddca6n%40googlegroups.com >> <https://groups.google.com/d/msgid/emscripten-discuss/71303cf3-2d27-4dfa-b17c-bf000edddca6n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-MeYutvr6j-zvQqEDdQbj-Hw%2BJnBwNHS5vcnJxyNxR5g%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-MeYutvr6j-zvQqEDdQbj-Hw%2BJnBwNHS5vcnJxyNxR5g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CA%2B_KjGYiK6nbyvzTUy0BSrJrTK06K4Hennem%3DB3cJnKnZLfK8Q%40mail.gmail.com.