From cd21cff29942f24ba7d38287186cce64d0e84e56 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 18 Aug 2022 17:35:02 +0530 Subject: feat(ext/flash): An optimized http/1.1 server (#15405) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartek IwaƄczuk Co-authored-by: Ben Noordhuis Co-authored-by: crowlkats Co-authored-by: Ryan Dahl --- cli/bench/testdata/bun_reactdom_ssr.jsx | 23 +++++++++++++++++++++++ cli/bench/testdata/deno_upgrade_http.js | 13 +++++++++++++ cli/bench/testdata/react-dom.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 cli/bench/testdata/bun_reactdom_ssr.jsx create mode 100644 cli/bench/testdata/deno_upgrade_http.js create mode 100644 cli/bench/testdata/react-dom.js (limited to 'cli/bench/testdata') diff --git a/cli/bench/testdata/bun_reactdom_ssr.jsx b/cli/bench/testdata/bun_reactdom_ssr.jsx new file mode 100644 index 000000000..e721033a2 --- /dev/null +++ b/cli/bench/testdata/bun_reactdom_ssr.jsx @@ -0,0 +1,23 @@ +// Bun uses a custom non-portable react-dom fork. +// TODO(@littledivy): Reenable this when it stops segfaulting. +import { renderToReadableStream } from "./react-dom.js"; +const headers = { + headers: { + "Content-Type": "text/html", + }, +}; + +const App = () => ( + + +

Hello World

+ + +); + +Bun.serve({ + async fetch(req) { + return new Response(await renderToReadableStream(), headers); + }, + port: 9000, +}); diff --git a/cli/bench/testdata/deno_upgrade_http.js b/cli/bench/testdata/deno_upgrade_http.js new file mode 100644 index 000000000..638761cf6 --- /dev/null +++ b/cli/bench/testdata/deno_upgrade_http.js @@ -0,0 +1,13 @@ +const { serve, upgradeHttp } = Deno; +const u8 = Deno.core.encode("HTTP/1.1 101 Switching Protocols\r\n\r\n"); + +async function handler(req) { + const [conn, _firstPacket] = upgradeHttp(req); + await conn.write(u8); + await conn.close(); +} + +serve(handler, { + hostname: "127.0.0.1", + port: 9000, +}); diff --git a/cli/bench/testdata/react-dom.js b/cli/bench/testdata/react-dom.js new file mode 100644 index 000000000..5fb0dbc78 --- /dev/null +++ b/cli/bench/testdata/react-dom.js @@ -0,0 +1,28 @@ +// deno-fmt-ignore-file +/** + * Bundled by jsDelivr using Rollup v2.75.7 and Terser v5.14.1. + * Original file: /npm/react-dom@18.2.0/server.browser.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ + import e from"react"; + var t={};var n={}; + /** + * @license React + * react-dom-server-legacy.browser.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var r=e;function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n