-
according to the readmes, the writer wasm binary size goes from ~366 KB to ~1.17 MB that seems to me to be a big jump; is there a way to reduce that or is there a need for it to be so much larger for the writer? (the reader is slightly smaller in v2 beta 3) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi, v2 enables
I believe finishing a feature comes prior to optimizing it. Although when building I also noticed the size bump. I believe the binary size can be further minimized, but it requires someone who are very familiar with cpp, c, webassembly and those two repos. I probably will look further into it in the future. I also appreciate suggestions from @axxel and @gitlost if there're some stupid mistakes I make that causes some unnecessary size bump.
Yes I converted some of the bindings from emscripten enum or string to numbers, e.g., no stringification is needed when passing the barcode format between js <-> cpp. I believe this kills some unneeded functions. I am also curious about your use case. Currently, writer, reader and full are provided as three different exports in this npm package and unused code should be tree-shakable if you only use one of them to build something. I may have some blinding spots on how people use this package, so would you elaborate on how this will be a concern for you? |
Beta Was this translation helpful? Give feedback.
-
I plan to use the wasm writer in Deno Deploy along with various other tools and I don't want to hit any memory limits. Not a huge concern at the moment but the jump in size surprised me so I figured I'd reach out to learn more. |
Beta Was this translation helpful? Give feedback.
@axxel I just realized I defined both the
ZXING_READERS
andZXING_WRITERS
options in theCMakeLists.txt
file, for no matter which target I'm to build 🤦. Therefore, when building the writer target, theCreatBarcode
will still use the reader code ifZXING_READERS
is defined. It seems won't use thereadBarcode
function ifZXING_READERS
is not defined, am I correct?So if that's the case, I need to set different options for different targets, and those options should be passed down to zxing-cpp:
reader
target:ZXING_READERS=ON
andZXING_WRITERS=OFF
writer
target:ZXING_READERS=OFF
andZXING_WRITERS=NEW
full
target:ZXING_READERS=ON
andZXING_WRITERS=NEW
Do you happen to know how to do that …