@2004scape/rsmod-pathfinder

中文文档
5.0.4发布于 2024/10/26ISCTypeScriptCommonJS零依赖近 30 天下载 1818

A breadth-first search path finder.

原始使用文档
文档目录7 节
  1. ✨ Installing
  2. 💪 Benchmarks
  3. Rust (Native):
  4. Rust (WebAssembly):
  5. AssemblyScript (WebAssembly):
  6. TypeScript:
  7. Contributor Notes

rsmod-pathfinder

A breadth-first search pathfinder. (The fastest in all the land)

Ported from Kotlin: 🔗 https://github.com/rsmod/rsmod/tree/main/engine/pathfinder


✨ Installing

🔗 https://www.npmjs.com/package/@2004scape/rsmod-pathfinder

npm i @2004scape/rsmod-pathfinder

🔗 https://crates.io/crates/rsmod-pathfinder

cargo add rsmod-pathfinder


💪 Benchmarks

I have created main.js and main.rs for synthetic examples of performance. They load in a full reconstruction of the Lumbridge mapsquare (64x64) tiles with full clipping flags set. Then in a loop it runs through 100k pathfinder requests to a destination +10 tiles North with a single access point to the destination.

--

AMD Ryzen 9 3900X 12-Core Processor 3.80 GHz

  • All tests below were done on the same machine with the same hardware.

Rust (Native):

Ran in Release mode on Windows x64 OS.

100k paths took: 279.3573ms; time per call: 2.793µs
100k paths took: 280.2238ms; time per call: 2.802µs
100k paths took: 281.206ms; time per call: 2.812µs
100k paths took: 278.8223ms; time per call: 2.788µs
100k paths took: 277.9747ms; time per call: 2.779µs
100k paths took: 279.5909ms; time per call: 2.795µs
100k paths took: 277.8473ms; time per call: 2.778µs
100k paths took: 281.0326ms; time per call: 2.81µs

Rust (WebAssembly):

Ran in Release mode on Windows x64 OS with NodeJS.

This typically takes about 850ms on average in a real world scenario tested on a server also using TypeScript.

100k paths took: 703ms; time per call: 7.03µs
100k paths took: 702ms; time per call: 7.02µs
100k paths took: 701ms; time per call: 7.01µs
100k paths took: 702ms; time per call: 7.02µs
100k paths took: 699ms; time per call: 6.99µs
100k paths took: 705ms; time per call: 7.05µs
100k paths took: 701ms; time per call: 7.01µs
100k paths took: 702ms; time per call: 7.02µs

AssemblyScript (WebAssembly):

100k paths took: 1534ms; time per call: 15.34µs
100k paths took: 1540ms; time per call: 15.40µs
100k paths took: 1544ms; time per call: 15.44µs
100k paths took: 1519ms; time per call: 15.19µs
100k paths took: 1533ms; time per call: 15.33µs
100k paths took: 1522ms; time per call: 15.22µs
100k paths took: 1527ms; time per call: 15.27µs

TypeScript:

100k paths took: 3858ms; time per call: 38.58µs
100k paths took: 3855ms; time per call: 38.55µs
100k paths took: 3828ms; time per call: 38.28µs
100k paths took: 3820ms; time per call: 38.20µs
100k paths took: 3833ms; time per call: 38.33µs
100k paths took: 3852ms; time per call: 38.52µs
100k paths took: 3844ms; time per call: 38.44µs

--

cargo bench

pathfinder/find_path    time:   [6.8195 µs 7.1890 µs 7.4884 µs]
                        thrpt:  [133.54 Kelem/s 139.10 Kelem/s 146.64 Kelem/s]


Contributor Notes

wasm-pack build --target nodejs --out-dir dist --out-name rsmod-pathfinder # Builds the wasm bundle.
~/IdeaProjects/wabt/bin/wasm2wat  dist/rsmod-pathfinder_bg.wasm -o src/rsmod.wat # Generates the wat file.
npm publish --access public # Publishes the version of this to npm.

版本与发布记录

@2004scape/rsmod-pathfinder 共发布 14 个版本,首次发布于 2024/01/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.0.4latest2024/10/262 年前
5.0.32024/10/262 年前
5.0.22024/10/262 年前
5.0.12024/05/292 年前
5.0.02024/05/242 年前
4.2.92024/04/242 年前

关于 @2004scape/rsmod-pathfinder 的常见问题

@2004scape/rsmod-pathfinder 是什么?

A breadth-first search path finder.

如何安装 @2004scape/rsmod-pathfinder?

在项目目录运行 npm install @2004scape/rsmod-pathfinder,或使用 pnpm add / yarn add / bun add。

@2004scape/rsmod-pathfinder 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@2004scape/rsmod-pathfinder 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@2004scape/rsmod-pathfinder 可以商用吗?

@2004scape/rsmod-pathfinder 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@2004scape/rsmod-pathfinder 的下载量有多少?

根据 npm 官方下载统计,@2004scape/rsmod-pathfinder 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,818 次,日均约 61 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@2004scape/rsmod-pathfinder 还在维护吗?

最新版本 5.0.4 发布于 2024/10/26(2 年前);至今共发布 14 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/01/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。