8000 finer timing in ManifoldCAD.org by elalish · Pull Request #1099 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

finer timing in ManifoldCAD.org #1099

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

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 0 additions & 6 deletions bindings/wasm/examples/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,11 @@ function disableCancel() {
runButton.classList.remove('red', 'cancel');
}

let t0 = performance.now();

function finishRun() {
disableCancel();
const t1 = performance.now();
const log = consoleElement.textContent;
// Remove "Running..."
consoleElement.textContent = log.substring(log.indexOf('\n') + 1);
console.log(
`Took ${(Math.round((t1 - t0) / 10) / 100).toLocaleString()} seconds`);
}

const output = {
Expand Down Expand Up @@ -501,7 +496,6 @@ async function run() {
console.log('Running...');
const output = await tsWorker.getEmitOutput(editor.getModel().uri.toString());
manifoldWorker.postMessage(output.outputFiles[0].text);
t0 = performance.now();
}

function cancel() {
Expand Down
10 changes: 10 additions & 0 deletions bindings/wasm/examples/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ let timesAccessor: Accessor;
let weightsAccessor: Accessor;
let weightsSampler: AnimationSampler;
let hasAnimation: boolean;
let t0 = 0;

export function cleanup() {
for (const obj of memoryRegistry) {
Expand Down Expand Up @@ -736,6 +737,10 @@ async function exportModels(defaults: GlobalDefaults, manifold?: Manifold) {
to3mf.items.push({objectID: `${object2globalID.get(manifold)}`});
}

const t1 = performance.now();
console.log(`Manifold took ${
(Math.round((t1 - t0) / 10) / 100).toLocaleString()} seconds`);

if (!hasAnimation) {
timesAccessor.dispose();
weightsAccessor.dispose();
Expand All @@ -759,6 +764,10 @@ async function exportModels(defaults: GlobalDefaults, manifold?: Manifold) {
[zipFile],
{type: 'application/vnd.ms-package.3dmanufacturing-3dmodel+xml'});

const t2 = performance.now();
console.log(`Exporting GLB & 3MF took ${
(Math.round((t2 - t1) / 10) / 100).toLocaleString()} seconds`);

return ({
glbURL: URL.createObjectURL(blobGLB),
threeMFURL: URL.createObjectURL(blob3MF)
Expand Down Expand Up @@ -786,6 +795,7 @@ function evaluateCADToManifold(code: string) {
}

export async function evaluateCADToModel(code: string) {
t0 = performance.now();
const {globalDefaults, manifold} = evaluateCADToManifold(code);
return await exportModels(globalDefaults, manifold);
}
Loading
0