diff --git a/.env b/.env index 8b4a6fa..bdcce1a 100644 --- a/.env +++ b/.env @@ -1,3 +1,7 @@ +# Whether to support WASM filters + +VITE_ENABLE_WASM_FILTERS=false + # --------------------------------- # Third party storage configuration # --------------------------------- diff --git a/.gitignore b/.gitignore index 7e2a946..6b4b504 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ node_modules # local env files .env.local .env.*.local +.env.production +.env.*.production # Log files npm-debug.log* @@ -21,3 +23,4 @@ pnpm-debug.log* *.njsproj *.sln *.sw? +build.sh \ No newline at end of file diff --git a/README.md b/README.md index ccb16e5..e7523fb 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,12 @@ Once the container is started, you can access BitMappery at `http://localhost:51 ## WebAssembly -BitMappery can also use WebAssembly to increase performance of image manipulation. The source -code is C based and compiled to WASM using [Emscripten](https://github.com/emscripten-core/emscripten). Because this setup is a little more cumbersome, the repository contains precompiled binaries -in the _./src/wasm/bin/_-folder meaning you can omit this setup if you don't intend to make changes -to these sources. +BitMappery can also use WebAssembly to _potentially_ increase performance of image manipulation. +WebAssembly filtering is a user controllable feature in the preferences pane, as long as the `.env` file has set +support for `VITE_ENABLE_WASM_FILTERS` to true. + +The source code is C based and compiled to WASM using [Emscripten](https://github.com/emscripten-core/emscripten). Because this setup is a little more cumbersome, the repository contains precompiled binaries in the _./src/wasm/bin/_-folder meaning you can +omit this setup if you don't intend to make changes to these sources. If you do wish to make contributions on this end, to compile the source (_/src/wasm/_) C-code to WASM, you will first need to prepare your environment (note the last _source_ call does not permanently update your paths): @@ -187,7 +189,7 @@ npm run wasm ### Benchmarks -On a particular (low powered) configuration, running all filters on a particular source takes: +On a particular (deliberately low powered) configuration, running all filters at their heaviest setting on a particular source takes: * 7000+ ms in JavaScript * 558 ms in WebAssembly @@ -195,7 +197,8 @@ On a particular (low powered) configuration, running all filters on a particular * 603 ms in WebAssembly inside a Web Worker Note that the WebAssembly Web Worker takes a performance hit from converting the ImageData buffer -to float32 prior to allocating the buffer in the WASM instance's memory. This can benefit from +to float32 prior to allocating the buffer in the WASM instance's memory. This could benefit from further tweaking to see if it gets closer to the JavaScript Web Worker performance. -WebAssembly filtering is a user controllable feature in the preferences pane. +However, as in the current setup the JS solution alone is performant enough _and you would need to write the +filter code twice_, the default for WASM is disabled. diff --git a/src/components/layer-filters/layer-filters.vue b/src/components/layer-filters/layer-filters.vue index fb30a15..7c0a34d 100644 --- a/src/components/layer-filters/layer-filters.vue +++ b/src/components/layer-filters/layer-filters.vue @@ -1,7 +1,7 @@ /** * The MIT License (MIT) * - * Igor Zinken 2021-2023 - https://www.igorski.nl + * Igor Zinken 2021-2024 - https://www.igorski.nl * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -84,6 +84,15 @@ :tooltip="'none'" /> +