Skip to content

Compresses the wasm binary to reduce its size when hosted#8

Open
CharlVS wants to merge 6 commits intoKomodo-Community:devfrom
GLEECBTC:gzip-kdf-wasm
Open

Compresses the wasm binary to reduce its size when hosted#8
CharlVS wants to merge 6 commits intoKomodo-Community:devfrom
GLEECBTC:gzip-kdf-wasm

Conversation

@CharlVS
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS commented Nov 26, 2025

Copied from upstream PR GLEECBTC#221

Compresses the wasm binary to reduce its size when hosted.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 45 to +49
kdf._isInitializing = true;
kdf._initPromise = init()
const gzipWasmBinPath = "../kdf/bin/kdflib_bg.wasm.gz"
const gzipKdfBinUrl = new URL(gzipWasmBinPath, import.meta.url);
const kdfBinBuffer = await loadCompressedWasm(gzipKdfBinUrl);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reset init flag when compressed wasm fetch fails

If loadCompressedWasm throws (e.g., missing kdflib_bg.wasm.gz or no DecompressionStream support), the error occurs before _initPromise is assigned, so _isInitializing remains true and no catch handler clears it. Subsequent init_wasm calls hit the _isInitializing branch that polls for _initPromise and will wait forever, leaving the KDF unusable after a single fetch failure.

Useful? React with 👍 / 👎.

Comment on lines +165 to +168
// Read, compress, and write
final wasmBytes = await entity.readAsBytes();
final originalSize = wasmBytes.length;
final compressedBytes = gzip.encode(wasmBytes);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add gzip import for wasm compression

The new compression branch calls gzip.encode(wasmBytes) but this file only imports dart:io; the gzip codec is defined in dart:convert, so this will not compile (Undefined name 'gzip') and the build step fails before copying assets. Import the proper codec or qualify it correctly.

Useful? React with 👍 / 👎.

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.

2 participants