Skip to content

Commit 731e731

Browse files
authored
perf: Define top-level earcut worker pool (#954)
### Change list - Define an earcut worker pool once in global scope, and reuse it for any polygon layers - This should (significantly?) improve perf for any polygonal layers (though not the h3 layer) - Load the worker source as _text_ from the version in `node_modules`. (`earcut.worker.min.js` is 15KB, and much easier to not have it be async). This means we don't need any async step, nor do we need to keep the worker source version in sync with our `geoarrow-js` version in `package.json` Depends on geoarrow/geoarrow-js#39 Closes #909
1 parent ecba2a5 commit 731e731

File tree

5 files changed

+440
-446
lines changed

5 files changed

+440
-446
lines changed

build.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import esbuild from "esbuild";
1+
import autoprefixer from "autoprefixer";
22
import dotenv from "dotenv";
3+
import esbuild from "esbuild";
34
import { sassPlugin } from "esbuild-sass-plugin";
4-
import tailwindcss from "tailwindcss";
5-
import autoprefixer from "autoprefixer";
65
import postcss from "postcss";
76
import postcssPresetEnv from "postcss-preset-env";
7+
import tailwindcss from "tailwindcss";
88

99
// Load environment variables from .env file
1010
dotenv.config();
@@ -40,6 +40,10 @@ esbuild.build({
4040
},
4141
}),
4242
],
43+
loader: {
44+
".worker.js": "text",
45+
".worker.min.js": "text",
46+
},
4347
// Code splitting didn't work initially because it tried to load from a local
4448
// relative path ./chunk.js
4549
// splitting: true,

0 commit comments

Comments
 (0)