Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

J12934
Copy link
Member

@J12934 J12934 commented Jul 16, 2025

Description

Using bun here over esbuild as bun generates correct esm code which works. esbuild right now outputs a weird mixture bundles which fails with cryptic "stream cannot be required dynamically" node error messages.

The performance speedup here is quit substantial:
(tester using hyperfine with a mocked out parser (always returning emtpy results), result files are fetched from a github gist and pushed to some webhook testing site.

e.g.

hyperfine --runs 25 -i 'SCAN_NAME=nmap NAMESPACE=default node --enable-source-maps parser-wrapper.js https://gist.githubusercontent.com/J12934/6440478a5005dafdf52c1236c859eed0/raw/bc212dffbdaaf03cdf119b60b0c5211533677b36/scanme-nmap-org.xml hyperfine --runs 25 -i 'SCAN_NAME=nmap NAMESPACE=default node --enable-source-maps parser-wrapper.js https://gist.githubusercontent.com/J12934/6440478a5005dafdf52c1236c859eed0/raw/bc212dffbdaaf03cdf119b60b0c5211533677b36/scanme-nmap-org.xml https://webhook.site/...

Results:

Regular:

  Time (mean ± σ):     467.0 ms ±  47.2 ms    [User: 443.8 ms, System: 97.7 ms]
  Range (min … max):   443.2 ms … 692.0 ms    25 runs

Bundled:

  Time (mean ± σ):     246.0 ms ±  16.3 ms    [User: 176.6 ms, System: 16.9 ms]
  Range (min … max):   232.7 ms … 319.7 ms    25 runs

So total runtime dropped from 467ms to 232ms, but even more significant system time dropped from ~100ms to ~20ms. So it should require a lot less cpu cycles and resources to execute 🥳

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • Make sure that all your commits are signed-off and that you are added to the Contributors file.
  • Make sure that all CI finish successfully.
  • Optional (but appreciated): Make sure that all commits are Verified.

Using bun here over esbuild as bun generates correct esm code which works.
esbuild right now outputs a weird mixture bundles which fails with cryptic "stream cannot be required dynamically" node error messages.

The performance speedup here is quit substantial:
(tester using hyperfine with a mocked out parser (always returning emtpy results), result files are fetched from a github gist and pushed to some webhook testing site.

e.g.

```sh
hyperfine --runs 25 -i 'SCAN_NAME=nmap NAMESPACE=default node --enable-source-maps parser-wrapper.js https://gist.githubusercontent.com/J12934/6440478a5005dafdf52c1236c859eed0/raw/bc212dffbdaaf03cdf119b60b0c5211533677b36/scanme-nmap-org.xml hyperfine --runs 25 -i 'SCAN_NAME=nmap NAMESPACE=default node --enable-source-maps parser-wrapper.js https://gist.githubusercontent.com/J12934/6440478a5005dafdf52c1236c859eed0/raw/bc212dffbdaaf03cdf119b60b0c5211533677b36/scanme-nmap-org.xml https://webhook.site/...
```

Results:

Regular:
  Time (mean ± σ):     467.0 ms ±  47.2 ms    [User: 443.8 ms, System: 97.7 ms]
  Range (min … max):   443.2 ms … 692.0 ms    25 runs

Bundled:
  Time (mean ± σ):     246.0 ms ±  16.3 ms    [User: 176.6 ms, System: 16.9 ms]
  Range (min … max):   232.7 ms … 319.7 ms    25 runs

So total runtime dropped from 443ms to 232ms, but even more significant system time dropped from ~100ms to ~20ms. So it should require a lot less cpu cycles and resources to execute 🥳

Signed-off-by: Jannik Hollenbach <[email protected]>
@J12934 J12934 self-assigned this Jul 16, 2025
@J12934 J12934 added the enhancement New feature or request label Jul 16, 2025
Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for docs-securecodebox ready!

Name Link
🔨 Latest commit 9699287
🔍 Latest deploy log https://app.netlify.com/projects/docs-securecodebox/deploys/68778f31a8885f0008497858
😎 Deploy Preview https://deploy-preview-3137--docs-securecodebox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@J12934 J12934 added this to the v5.0.0 milestone Jul 16, 2025
Copy link

@J12934 J12934 moved this from Triage to To Review in secureCodeBox Jul 16, 2025
@J12934 J12934 changed the title Speed up execution time by up to 2x & reduce cpu load of parsers by up to 5x by bundling parser-sdk Speed up parser execution time by up to 2x & reduce cpu load by up to 5x by bundling parser-sdk Jul 16, 2025
@github-project-automation github-project-automation bot moved this from To Review to Reviewer Approved in secureCodeBox Jul 16, 2025
@Weltraumschaf Weltraumschaf merged commit 52d0b92 into secureCodeBox:main Jul 16, 2025
51 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in secureCodeBox Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants