@mirascript/mirascript 0.1.62-alpha.21 → 0.1.62-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +11 -3
  2. package/bench/index.ts +0 -45
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@mirascript/mirascript",
3
- "version": "0.1.62-alpha.21",
3
+ "version": "0.1.62-alpha.22",
4
4
  "author": "CloudPSS",
5
5
  "license": "MIT",
6
6
  "description": "An expression based scripting language.",
7
+ "keywords": [
8
+ "mirascript",
9
+ "language",
10
+ "compiler",
11
+ "runtime",
12
+ "vm"
13
+ ],
14
+ "homepage": "https://mira.cloudpss.net",
7
15
  "repository": {
8
16
  "type": "git",
9
17
  "url": "git+https://github.com/CloudPSS/MiraScript.git",
@@ -34,8 +42,8 @@
34
42
  "@cloudpss/worker": "^0.1.11",
35
43
  "source-map-js": "^1.2.1",
36
44
  "supports-color": "^10.2.2",
37
- "@mirascript/bindings": "~0.1.62-alpha.21",
38
- "@mirascript/constants": "~0.1.62-alpha.21"
45
+ "@mirascript/bindings": "~0.1.62-alpha.22",
46
+ "@mirascript/constants": "~0.1.62-alpha.22"
39
47
  },
40
48
  "devDependencies": {
41
49
  "@types/node": "^25.6.0",
package/bench/index.ts DELETED
@@ -1,45 +0,0 @@
1
- import { Bench } from 'tinybench';
2
- import { compile, compileSync, createVmContext } from '@mirascript/mirascript';
3
-
4
- const bench = new Bench({ name: 'simple benchmark', time: 100 });
5
- const source = `sin(x) + cos(y + PI / 2) + `.repeat(1) + '0';
6
- const env = { x: 1, y: 2 };
7
-
8
- bench
9
- .add('compile', async () => {
10
- await Promise.all(Array.from({ length: 10 }).map(async () => compile(source)));
11
- })
12
- .add('compileSync', () => {
13
- compileSync(source);
14
- });
15
-
16
- bench.add('createVmContext', () => {
17
- return createVmContext(env);
18
- });
19
-
20
- const vmContext = createVmContext(env);
21
- const script = compileSync(source);
22
- bench.add('run', () => {
23
- return script(vmContext);
24
- });
25
-
26
- bench.add('nativeCompile', () => {
27
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
28
- return new Function('context', `const {sin,cos,PI,x,y} = context; return ${source};`);
29
- });
30
- bench.add('nativeCreateContext', () => {
31
- return { __proto__: Math, ...env };
32
- });
33
- const nativeContext = { __proto__: Math, ...env };
34
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
35
- const nativeScript = new Function('context', `const {sin,cos,PI,x,y} = context; return ${source};`) as (
36
- context: Record<string, unknown>,
37
- ) => unknown;
38
-
39
- bench.add('nativeRun', () => {
40
- return nativeScript(nativeContext);
41
- });
42
-
43
- await bench.run();
44
- // eslint-disable-next-line no-console
45
- console.table(bench.table());