Skip to content

Instantly share code, notes, and snippets.

@guest271314
Created February 19, 2023 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guest271314/a8eace7cb17019a8833a28c297759072 to your computer and use it in GitHub Desktop.
Save guest271314/a8eace7cb17019a8833a28c297759072 to your computer and use it in GitHub Desktop.
Streaming data locally: Native Messaging with IPC and JSON vs. HTTPS server with fetch(), ReadableStream, Response

The application code is the same: parec -d @DEFAULT_MONITOR@ to capture 2 channel PCM output to headphones or speakers.

The values below were taken during the capture and stream to the browser.

Deno (HTTPS server, fetch() in browser, ReadableStream, Response in server):

  • VSZ 5.4GB
  • RSS 38.1MB
  • CPU (deno) 38%
  • CPU (system) 85%

QuickJS (Native Messaging, runtime.sendMessage, runtime.onMessage, IPC, JSON/JSON-like):

  • VSZ 4.7MB
  • RSS 3MB
  • CPU (qjs) 4%
  • CPU (system) 57%

deno_https_streaming qjs_json_streaming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment