Conversation
| // point.geojson x 52,230,993 ops/sec ±0.70% (96 runs sampled) | ||
| // points-with-weights.geojson x 24,802,237 ops/sec ±0.33% (100 runs sampled) | ||
| // polygon-without-weights.geojson x 18,423,881 ops/sec ±0.28% (100 runs sampled) | ||
| // polygon.geojson x 24,990,920 ops/sec ±0.45% (99 runs sampled) |
There was a problem hiding this comment.
Hilariously this is almost exactly 10x the original speed due to hardware progression over the years.
| import type { BBox, Feature, GeoJsonProperties, Point } from "geojson"; | ||
| import { bbox } from "@turf/bbox"; | ||
| import { point, Id, AllGeoJSON } from "@turf/helpers"; | ||
| import { point, type Id, type AllGeoJSON } from "@turf/helpers"; |
There was a problem hiding this comment.
These type keywords are required when migrating from tsx to node native execution.
| TAPE_PACKAGES.push(name); | ||
| } else { | ||
| NODE_TEST_PACKAGES.push(name); | ||
| } |
There was a problem hiding this comment.
Automatically differentiate if test.ts is tape or node native
| scripts: { | ||
| bench: "node bench.ts", | ||
| "test:node": "node --test", | ||
| "test:tape": REMOVE, |
There was a problem hiding this comment.
Handles swapping bench from tsx execution to node as we switch to node native testing.
| scripts: { | ||
| bench: "tsx bench.ts", | ||
| "test:tape": "tsx test.ts", | ||
| "test:node": REMOVE, |
There was a problem hiding this comment.
Just in case we ever migrate from node native back to tape.
| }, | ||
| }, | ||
| includePackages: NODE_TEST_PACKAGES, | ||
| }), |
There was a problem hiding this comment.
When we switch to node native testing and use the shared fixture runner, we get to remove a lot of dependencies in favor of the builtin tooling.
| "@types/benchmark": "^2.1.5", | ||
| "@types/node": "22.15.3", | ||
| "acorn": "^8.14.1", | ||
| "benchmark": "^2.1.4", |
There was a problem hiding this comment.
This is required because of shared/benchFixtures.mts, but we get to remove it from each package.
| "skipLibCheck": true, | ||
| "erasableSyntaxOnly": true | ||
| "erasableSyntaxOnly": true, | ||
| "rewriteRelativeImportExtensions": true |
There was a problem hiding this comment.
This seems to work just fine for us now. I had to do some extra stuff in geoclipper2 to have this all work with noEmit and a second tsconfig.json file for the production builds. I can revisit this situation if moving from tsup to raw tsc causes an issue.
7b73513 to
b88c3d0
Compare
Some of the basics for modernizing our test runner to get away from
tape.glob,load-json-file,tape,tsx, andwrite-json-file