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

Considerably worse performance on Windows #172

Closed
brianjenkins94 opened this issue Oct 21, 2024 · 5 comments
Closed

Considerably worse performance on Windows #172

brianjenkins94 opened this issue Oct 21, 2024 · 5 comments

Comments

@brianjenkins94
Copy link

brianjenkins94 commented Oct 21, 2024

This is just a casual observation that I noticed when running humanify on my Windows machine vs. my Mac, both using OpenAI as the backend.

I'll see if I can take some benchmarks, because Windows looked like it was going to take days and Mac looks like it's only going to take a couple of hours.

@jehna
Copy link
Owner

jehna commented Oct 21, 2024

Can you verify that they are using the same version?

@brianjenkins94
Copy link
Author

brianjenkins94 commented Oct 21, 2024

I don't think this was a great test, my internet seemed like it was struggling today.

I'll run these again at some point but I don't need to be cluttering up your issue tracker.

Does humanify do multiple passes, pick up where it left off or cache anything at the moment?

M1 Pro

macOS v14.4.1
npm v10.2.4
node v20.11.1
humanifyjs v2.2.0

Input file: preact.min.js (v10.24.3)
Input command: ./hyperfine --runs 1 --show-output "npx humanifyjs openai "preact.min.js"
Processing file 1/1
Processing: 100%
Done! You can find your unminified code in output
  Time (abs ≡):        2028.960 s               [User: 7.194 s, System: 0.630 s]

Windows 10

Windows 21H2
npm v10.3.0
node v22.2.0
humanifyjs v2.2.0

Input file: preact.min.js (v10.24.3)
Input command: ./hyperfine.exe --runs 1 --show-output "npx humanifyjs openai "preact.min.js"
Processing file 1/1
Processing: 100%
Done! You can find your unminified code in output
  Time (abs ≡):        1721.797 s               [User: 6.734 s, System: 1.154 s]

@brianjenkins94
Copy link
Author

brianjenkins94 commented Oct 22, 2024

I think maybe I just misunderstood the way it's divvying up the files or there's an element of randomness to the ordering of it.

@0xdevalias
Copy link

0xdevalias commented Oct 23, 2024

Does humanify do multiple passes, pick up where it left off or cache anything at the moment?

@brianjenkins94 To my knowledge I don't think it has any cache/etc method implemented currently.

@brianjenkins94
Copy link
Author

brianjenkins94 commented Oct 27, 2024

I also noticed that this:

https://github.com/jehna/humanify/blob/main/src/plugins/webcrack.ts#L9-L20

will re-convert (and bundle?) any other files that happen to be in the output directory.

Workaround:

async function unminify(filename, outputDir, plugins = []) {
  ensureFileExists(filename);
  const bundledCode = await fs.readFile(filename, "utf-8");

+  try { await fs.rm("intermediate", { "recursive": true }); } catch (error) {}
+  await fs.mkdir("intermediate");
-  const extractedFiles = await webcrack(bundledCode, outputDir);
+  const extractedFiles = await webcrack(bundledCode, "intermediate");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants