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

Remove md5 and use xxHash128 for hashing algorithm in debug infos #297

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
832 changes: 416 additions & 416 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions rapier-compat/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tsconfig,json files:

- tsconfig.common.json - shared TypeScript options
- tsconfig.pkg2d.json - config for compiling rapier2d-compat
- tsconfig.pkg3d.json - config for compiling rapier3d-compat
- tconfig.json - for IDE (VSCode) and unit tests. Includes Jest types.
- tsconfig.common.json - shared TypeScript options
- tsconfig.pkg2d.json - config for compiling rapier2d-compat
- tsconfig.pkg3d.json - config for compiling rapier3d-compat
- tconfig.json - for IDE (VSCode) and unit tests. Includes Jest types.
18 changes: 8 additions & 10 deletions rapier2d/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rapier2d/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"typedoc": "^0.25.13"
},
"dependencies": {
"typescript": "^5.7.2",
"wasm-pack": "^0.12.1"
}
}
17 changes: 7 additions & 10 deletions rapier3d/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rapier3d/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"typedoc": "^0.25.13"
},
"dependencies": {
"typescript": "^5.7.2",
"wasm-pack": "^0.12.1"
}
}
85 changes: 15 additions & 70 deletions testbed2d/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions testbed2d/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
},
"dependencies": {
"@dimforge/rapier2d": "file:../rapier2d",
"hash-wasm": "^4.12.0",
"lil-gui": "^0.17.0",
"md5": "^2.3.0",
"pixi-viewport": "^4.37.0",
"pixi.js": "^6.3.2",
"seedrandom": "^3.0.5",
"stats.js": "^0.17.0"
},
"devDependencies": {
"@types/md5": "^2.3.2",
"@types/seedrandom": "^3.0.2",
"@types/stats.js": "^0.17.0",
"copy-webpack-plugin": "^11.0.0",
Expand Down
8 changes: 6 additions & 2 deletions testbed2d/src/Gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ export class Gui {
text += "<br/>[Step " + infos.stepId + "]";

if (infos.worldHash) {
text += "<br/>World hash (MD5): " + infos.worldHash.toString();
text += "<br/>World hash time (MD5): " + infos.worldHashTime + "ms";
text +=
"<br/>World hash (xxHash128): " + infos.worldHash.toString();
text +=
"<br/>World hash time (xxHash128): " +
infos.worldHashTime +
"ms";
text += "<br/>Snapshot time: " + infos.snapshotTime + "ms";
}
this.debugText.innerHTML = text;
Expand Down
18 changes: 9 additions & 9 deletions testbed2d/src/Testbed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Graphics} from "./Graphics";
import {Gui} from "./Gui";
import type {DebugInfos} from "./Gui";
import * as md5 from "md5";
import {xxhash128} from "hash-wasm";
import type * as RAPIER from "@dimforge/rapier2d";

type RAPIER_API = typeof import("@dimforge/rapier2d");
Expand Down Expand Up @@ -164,14 +164,14 @@ export class Testbed {
snapshotTime: 0,
};
t0 = performance.now();
debugInfos.worldHash = md5(snapshot);
t1 = performance.now();
let worldHashTime = t1 - t0;

debugInfos.worldHashTime = worldHashTime;
debugInfos.snapshotTime = snapshotTime;

this.gui.setDebugInfos(debugInfos);
xxhash128(snapshot).then((hash) => {
debugInfos.worldHash = hash;
t1 = performance.now();
let worldHashTime = t1 - t0;
debugInfos.worldHashTime = worldHashTime;
debugInfos.snapshotTime = snapshotTime;
this.gui.setDebugInfos(debugInfos);
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion testbed2d/static/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Loading