sql-js / sql-js/sql.js

Reducing code-size for web version

Open
#165 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Currently even the minified version is a whopping 2.04 MB which is a rather heavy even when gzipped. Looking through the code, I noticed that Emscripten's canvas, SDL audio and requestAnimationFrame are included in the minified output, which are obviously not used by SQLite.

When compiling only for browser, ENVIRONMENT_IS_NODE and ENVIRONMENT_IS_SHELL would be false and could be dead-code eliminated. Also, the filesystem and TTY also takes out a substantial chunk of code which could be unnecessary. _sysconf is also ever called with 30 so it could be aggressively inlined.

I wonder if there are options to set which could reduce the code size?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the browser compilation configuration and how Emscripten includes canvas, SDL audio, requestAnimationFrame, filesystem, TTY, and _sysconf in the minified output. Determine which compilation options can exclude unused code, then verify that the browser build remains functional with a reduced minified size.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sqlite, wasm
Domain
build-system, database, web-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.