mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add Three.js benchmark
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import "three/three1";
|
||||
import "three/three2";
|
||||
import "three/three3";
|
||||
import "three/three4";
|
||||
import "three/three5";
|
||||
import "three/three6";
|
||||
import "three/three7";
|
||||
import "three/three8";
|
||||
import "three/three9";
|
||||
import "three/three10";
|
||||
import "three/three1.js";
|
||||
import "three/three2.js";
|
||||
import "three/three3.js";
|
||||
import "three/three4.js";
|
||||
import "three/three5.js";
|
||||
import "three/three6.js";
|
||||
import "three/three7.js";
|
||||
import "three/three8.js";
|
||||
import "three/three9.js";
|
||||
import "three/three10.js";
|
||||
// import "@babel/standalone/babel";
|
||||
|
||||
@@ -6,6 +6,25 @@
|
||||
"@babel/standalone": "^7.15.3",
|
||||
"lodash": "^4.17.21",
|
||||
"three.js": "^0.77.1",
|
||||
"underscore": "^1.13.1"
|
||||
"underscore": "^1.13.1",
|
||||
"webpack": "^5.56.0"
|
||||
},
|
||||
"type": "module",
|
||||
"browserslist": [
|
||||
"last 1 version"
|
||||
],
|
||||
"scripts": {
|
||||
"generate": "cp node_modules/three/three.js node_modules/three/three1.js; cp node_modules/three/three.js node_modules/three/three2.js; cp node_modules/three/three.js node_modules/three/three3.js; cp node_modules/three/three.js node_modules/three/three4.js; cp node_modules/three/three.js node_modules/three/three5.js; cp node_modules/three/three.js node_modules/three/three6.js; cp node_modules/three/three.js node_modules/three/three7.js; cp node_modules/three/three.js node_modules/three/three8.js; cp node_modules/three/three.js node_modules/three/three9.js; cp node_modules/three/three.js node_modules/three/three10.js",
|
||||
"bench": "hyperfine \"bun bun ./index.js\" \"GOMAXPROCS=1 bun bun ./index.js\" \"esbuild --bundle ./index.js --platform=browser --format=esm > /dev/null\" \"swc ./node_modules/three/three1.js ./node_modules/three/three2.js ./node_modules/three/three3.js ./node_modules/three/three4.js ./node_modules/three/three5.js ./node_modules/three/three6.js ./node_modules/three/three7.js ./node_modules/three/three8.js ./node_modules/three/three9.js ./node_modules/three/three10.js -C \"module.type=es6\" --no-swcrc -s false -o /tmp/out.swc.js\" \"node_modules/.bin/parcel build --no-optimize --no-source-maps --no-content-hash --no-cache --no-autoinstall ./index.js\" --prepare=\"rm -rf dist *.bun .parcel-cache;\"",
|
||||
"bench-sync": "hyperfine \"GOMAXPROCS=1 bun bun ./index.js\" \"GOMAXPROCS=1 esbuild --bundle ./index.js --platform=browser --format=esm > /dev/null\" \"swc ./node_modules/three/three1.js ./node_modules/three/three2.js ./node_modules/three/three3.js ./node_modules/three/three4.js ./node_modules/three/three5.js ./node_modules/three/three6.js ./node_modules/three/three7.js ./node_modules/three/three8.js ./node_modules/three/three9.js ./node_modules/three/three10.js -C \"module.type=es6\" --sync --no-swcrc -s false -o /tmp/out.swc.js\" --prepare=\"rm -rf *.bun\" ",
|
||||
"bench-all": "hyperfine \"bun bun ./index.js\" \"esbuild --bundle ./index.js --platform=browser --format=esm > /dev/null\" \"esbuild --bundle ./index.js --platform=browser --format=esm > /dev/null\" \"swc ./node_modules/three/three1.js ./node_modules/three/three2.js ./node_modules/three/three3.js ./node_modules/three/three4.js ./node_modules/three/three5.js ./node_modules/three/three6.js ./node_modules/three/three7.js ./node_modules/three/three8.js ./node_modules/three/three9.js ./node_modules/three/three10.js -C \"module.type=es6\" --no-swcrc -s false -o /tmp/out.swc.js\" \"GOMAXPROCS=1 bun bun ./index.js\" \"GOMAXPROCS=1 esbuild --bundle ./index.js --platform=browser --format=esm > /dev/null\" \"swc ./node_modules/three/three1.js ./node_modules/three/three2.js ./node_modules/three/three3.js ./node_modules/three/three4.js ./node_modules/three/three5.js ./node_modules/three/three6.js ./node_modules/three/three7.js ./node_modules/three/three8.js ./node_modules/three/three9.js ./node_modules/three/three10.js -C \"module.type=es6\" --sync --no-swcrc -s false -o /tmp/out.swc.js\" --prepare=\"rm -rf *.bun\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.5",
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@parcel/core": "^2.0.0-rc.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"parcel": "^2.0.0-rc.0",
|
||||
"webpack-cli": "^4.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ pub usingnamespace @import("strings.zig");
|
||||
pub const Environment = @import("env.zig");
|
||||
|
||||
|
||||
pub const default_allocator: *std.mem.Allocator = if (isTest or Environment.isLinux)
|
||||
pub const default_allocator: *std.mem.Allocator = if (isTest)
|
||||
std.heap.c_allocator
|
||||
else
|
||||
@import("./memory_allocator.zig").c_allocator;
|
||||
|
||||
@@ -1119,13 +1119,14 @@ pub const RequestContext = struct {
|
||||
javascript_disabled = true;
|
||||
}
|
||||
var start_timer = std.time.Timer.start() catch unreachable;
|
||||
|
||||
|
||||
|
||||
var stdout = std.io.getStdOut();
|
||||
var stderr = std.io.getStdErr();
|
||||
var output_source = Output.Source.init(stdout, stderr);
|
||||
defer Output.flush();
|
||||
Output.Source.set(&output_source);
|
||||
@import("javascript/jsc/JavascriptCore.zig").JSCInitialize();
|
||||
|
||||
|
||||
js_ast.Stmt.Data.Store.create(std.heap.c_allocator);
|
||||
|
||||
@@ -22,7 +22,6 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) nore
|
||||
}
|
||||
pub var start_time: i128 = 0;
|
||||
pub fn main() anyerror!void {
|
||||
@import("javascript/jsc/JavascriptCore.zig").JSCInitialize();
|
||||
start_time = std.time.nanoTimestamp();
|
||||
|
||||
// The memory allocator makes a massive difference.
|
||||
|
||||
Reference in New Issue
Block a user