aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/bun-jsc.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-06-07 22:32:46 -0700
committerGravatar GitHub <noreply@github.com> 2022-06-07 22:32:46 -0700
commit43de33afc7fcc4cab25f578566e225ba9e4d4258 (patch)
tree141676095981741c3a5740093fee79ed12d4edcd /integration/bunjs-only-snippets/bun-jsc.test.js
parent958fc3d4f5ba2a1fb5b5e1e2b9fe3a4500dbefc6 (diff)
downloadbun-43de33afc7fcc4cab25f578566e225ba9e4d4258.tar.gz
bun-43de33afc7fcc4cab25f578566e225ba9e4d4258.tar.zst
bun-43de33afc7fcc4cab25f578566e225ba9e4d4258.zip
Web Streams API (#176)
* [bun.js] `WritableStream`, `ReadableStream`, `TransformStream`, `WritableStreamDefaultController`, `ReadableStreamDefaultController` & more * Implement `Blob.stream()` * Update streams.test.js * Fix sourcemaps crash * [TextEncoder] 3x faster in hot loops * reading almost works * start to implement native streams * Implement `Blob.stream()` * Implement `Bun.file(pathOrFd).stream()` * Add an extra function * [fs.readFile] Improve performance * make jsc bindings a little easier to work with * fix segfault * faster async/await + readablestream optimizations * WebKit updates * More WebKit updates * Add releaseWEakrefs binding * `bun:jsc` * More streams * Update streams.test.js * Update Makefile * Update mimalloc * Update WebKit * Create bun-jsc.test.js * Faster ReadableStream * Fix off by one & exceptions * Handle empty files/blobs * Update streams.test.js * Move streams to it's own file * temp * impl #1 * take two * good enough for now * Implement `readableStreamToArray`, `readableStreamToArrayBuffer`, `concatArrayBuffers` * jsxOptimizationInlining * Fix crash * Add `jsxOptimizationInline` to Bun.Transpiler * Update Transpiler types * Update js_ast.zig * Automatically choose production mode when NODE_ENV="production" * Update cli.zig * [jsx] Handle defaultProps when inlining * Update transpiler.test.js * uncomment some tests Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'integration/bunjs-only-snippets/bun-jsc.test.js')
-rw-r--r--integration/bunjs-only-snippets/bun-jsc.test.js94
1 files changed, 94 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/bun-jsc.test.js b/integration/bunjs-only-snippets/bun-jsc.test.js
new file mode 100644
index 000000000..e329bc092
--- /dev/null
+++ b/integration/bunjs-only-snippets/bun-jsc.test.js
@@ -0,0 +1,94 @@
+import { describe, expect, it } from "bun:test";
+import {
+ describe as jscDescribe,
+ describeArray,
+ gcAndSweep,
+ fullGC,
+ edenGC,
+ heapSize,
+ heapStats,
+ memoryUsage,
+ getRandomSeed,
+ setRandomSeed,
+ isRope,
+ callerSourceOrigin,
+ noFTL,
+ noOSRExitFuzzing,
+ optimizeNextInvocation,
+ numberOfDFGCompiles,
+ releaseWeakRefs,
+ totalCompileTime,
+ reoptimizationRetryCount,
+ drainMicrotasks,
+} from "bun:jsc";
+
+describe("bun:jsc", () => {
+ function count() {
+ var j = 0;
+ for (var i = 0; i < 999999; i++) {
+ j += i + 2;
+ }
+
+ return j;
+ }
+
+ it("describe", () => {
+ jscDescribe([]);
+ });
+ it("describeArray", () => {
+ describeArray([1, 2, 3]);
+ });
+ it("gcAndSweep", () => {
+ gcAndSweep();
+ });
+ it("fullGC", () => {
+ fullGC();
+ });
+ it("edenGC", () => {
+ edenGC();
+ });
+ it("heapSize", () => {
+ expect(heapSize() > 0).toBe(true);
+ });
+ it("heapStats", () => {
+ heapStats();
+ });
+ it("memoryUsage", () => {
+ memoryUsage();
+ });
+ it("getRandomSeed", () => {
+ getRandomSeed(2);
+ });
+ it("setRandomSeed", () => {
+ setRandomSeed(2);
+ });
+ it("isRope", () => {
+ expect(isRope("a" + 123 + "b")).toBe(true);
+ expect(isRope("abcdefgh")).toBe(false);
+ });
+ it("callerSourceOrigin", () => {
+ expect(callerSourceOrigin()).toBe(import.meta.url);
+ });
+ it("noFTL", () => {});
+ it("noOSRExitFuzzing", () => {});
+ it("optimizeNextInvocation", () => {
+ count();
+ optimizeNextInvocation(count);
+ count();
+ });
+ it("numberOfDFGCompiles", () => {
+ expect(numberOfDFGCompiles(count)).toBe(3);
+ });
+ it("releaseWeakRefs", () => {
+ releaseWeakRefs();
+ });
+ it("totalCompileTime", () => {
+ totalCompileTime(count);
+ });
+ it("reoptimizationRetryCount", () => {
+ reoptimizationRetryCount(count);
+ });
+ it("drainMicrotasks", () => {
+ drainMicrotasks();
+ });
+});