Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tileset): Use Web Workers #108

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

donmccurdy
Copy link
Member

@donmccurdy donmccurdy commented Feb 20, 2025

Work in progress. Open questions:

  • Avoid starting Web Workers until a widget request is made. We don't want to spawn workers if the user is just rendering the tileset.
  • How many Web Workers should be spawned? A singleton? One per dataset? A pool of N workers, with datasets balanced among them?
  • If we're using ES Module workers, is that compatible with CJS builds? Workers will be ESM-only.
  • If workers are opt-in or opt-out, what's the API to switch? Opt-out, by widgetSourceWorker: false option.
  • If Microbundle generates named chunks like widget-tileset-worker-BXxfh1Ze.js, is that compatible with package.json#exports? Replaced microbundle with tsup.

These issues could probably be solved like deck.gl does, by publishing worker code to a CDN and loading that... But this makes builds and development more complicated, and CDNs may fail, I'd prefer to avoid the CDN.

The last version of Node.js that doesn't support require(esm) will reach end-of-life in April... maybe we can say Web Workers are available only for ESM builds? We can use an extra entrypoint (@carto/api-client/worker) for the worker code.

@donmccurdy donmccurdy marked this pull request as draft February 20, 2025 21:48
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.

1 participant