pacc 9.2.4 → 9.2.6

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.
package/README.md CHANGED
@@ -24,6 +24,43 @@ const result = expand("${a + 1}",{ root: { a: 2 }});
24
24
 
25
25
  ```
26
26
 
27
+ # Benchmark
28
+
29
+ benchmark avg (min … max) p75 / p99 (min … top 1%)
30
+
31
+ ***
32
+
33
+ "\[n<5].l" 1.17 µs/iter 1.67 µs █
34
+ (833.64 ns … 2.47 µs) 2.42 µs █
35
+ (281.78 b … 3.28 kb) 3.01 kb █▇▂▁▃▂▁▁▁▁▁▃▂▄▄▂▂▁▁▂▁
36
+ 4.72 ipc ( 2.55% stalls) 98.55% L1 data cache
37
+ 3.75k cycles 17.68k instructions 39.84% retired LD/ST ( 7.04k)
38
+
39
+ parse a.b.c.d.e.f.g.h.i.j.k.l.m.n 2.96 µs/iter 3.25 µs ▂█▂ ▅
40
+ (2.60 µs … 3.44 µs) 3.41 µs ███▅▅ ▅█▂▂▂▂
41
+ ( 6.10 kb … 6.11 kb) 6.10 kb █████▄▁▁▁▁▁▁▄▄▁██████
42
+ 5.09 ipc ( 2.02% stalls) 99.10% L1 data cache
43
+ 9.40k cycles 47.87k instructions 40.50% retired LD/ST ( 19.38k)
44
+
45
+ parseOnly a.b.c.d.e.f.g.h.i.j.k.l.m.n 2.51 µs/iter 2.85 µs █
46
+ (2.18 µs … 3.36 µs) 3.35 µs █▆
47
+ ( 4.54 kb … 5.43 kb) 5.41 kb ██▄▄▂▁▁▁▁▃▂█▇█▂▁▂▁▂▁▂
48
+ 5.12 ipc ( 2.18% stalls) 98.98% L1 data cache
49
+ 8.05k cycles 41.20k instructions 40.73% retired LD/ST ( 16.78k)
50
+
51
+ tokens a.b.c.d.e.f.g.h.i.j.k.l.m.n 1.66 µs/iter 1.68 µs ▆ █▄ ▃
52
+ (1.61 µs … 1.75 µs) 1.74 µs ▅█▄██▄ █▂ ▂▅
53
+ ( 4.41 kb … 4.42 kb) 4.41 kb ██████▅▁██▃▅▃▆▆██▃▃▁▆
54
+ 5.67 ipc ( 2.53% stalls) 99.12% L1 data cache
55
+ 5.32k cycles 30.18k instructions 40.68% retired LD/ST ( 12.27k)
56
+
57
+ tokens "abc" "
58
+ " "abcdefghijklmnopqrstuvwxyz" 1.23 µs/iter 1.12 µs █
59
+ (1.02 µs … 2.23 µs) 1.85 µs █▆
60
+ ( 2.52 kb … 4.17 kb) 3.43 kb ███▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▇▄▃
61
+ 6.02 ipc ( 2.26% stalls) 99.24% L1 data cache
62
+ 3.94k cycles 23.72k instructions 39.67% retired LD/ST ( 9.41k)
63
+
27
64
  # API
28
65
 
29
66
  <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
@@ -0,0 +1,44 @@
1
+ import { run, bench, boxplot, summary } from "mitata";
2
+ import { tokens } from "../src/tokens.mjs";
3
+ import { parse, parseOnly } from "../src/parser.mjs";
4
+
5
+ const root = new Map([
6
+ ["a", { n: 1, l: [1, 2] }],
7
+ ["b", { n: 3, x: 7, l: [3, 4] }],
8
+ [
9
+ "c",
10
+ {
11
+ d: {
12
+ e: { f: { g: { h: { i: { j: { k: { l: { m: { n: "xyz" } } } } } } } } }
13
+ }
14
+ }
15
+ ]
16
+ ]);
17
+
18
+ const root2 = {
19
+ a: {
20
+ b: {
21
+ c: {
22
+ d: {
23
+ e: {
24
+ f: { g: { h: { i: { j: { k: { l: { m: { n: "xyz" } } } } } } } }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ };
31
+
32
+ bench('"[n<5].l"', () => parse("[n<5].l", { root }));
33
+
34
+ const expression = "a.b.c.d.e.f.g.h.i.j.k.l.m.n";
35
+
36
+ bench(`parse ${expression}`, () => parse(expression, { root: root2 }));
37
+ bench(`parseOnly ${expression}`, () => parseOnly(expression, {}));
38
+ bench(`tokens ${expression}`, () => Array.from(tokens(expression, {})));
39
+
40
+ const expression2 = '"abc" "\t\n" "abcdefghijklmnopqrstuvwxyz"';
41
+
42
+ bench(`tokens ${expression2}`, () => Array.from(tokens(expression2, {})));
43
+
44
+ await run();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "9.2.4",
3
+ "version": "9.2.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
- "packageManager": "npm@11.10.0+sha512.8bc844e37892200305b98562f13c6c10849d10b3387c8cdaeb4d1a2e32746a79063cba9dd284cf28c26a01c3bf4169b7d3b31b4a5586cc970d6749463108073c",
8
+ "packageManager": "npm@11.10.0",
9
9
  "types": "./types/module.d.mts",
10
10
  "exports": {
11
11
  ".": {
@@ -38,18 +38,21 @@
38
38
  "docs": "documentation readme --section=API ./src**/*.mjs",
39
39
  "lint": "node --run lint:docs && node --run lint:typescript",
40
40
  "lint:docs": "documentation lint ./src**/*.mjs",
41
- "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
41
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
42
+ "benchmark": "node benchmark/*.mjs"
42
43
  },
43
44
  "devDependencies": {
44
- "ava": "^6.4.1",
45
- "browser-ava": "^2.3.53",
46
- "c8": "^10.1.3",
45
+ "@mitata/counters": "^0.0.8",
46
+ "ava": "^7.0.0",
47
+ "browser-ava": "^2.3.54",
48
+ "c8": "^11.0.0",
47
49
  "documentation": "^14.0.3",
50
+ "mitata": "^1.0.34",
48
51
  "semantic-release": "^25.0.3",
49
52
  "typescript": "^5.9.3"
50
53
  },
51
54
  "engines": {
52
- "node": ">=24.13.1"
55
+ "node": ">=24.14.0"
53
56
  },
54
57
  "repository": {
55
58
  "type": "git",
package/src/parser.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { tokens, EOF } from "./tokens.mjs";
2
2
 
3
- export function parseOnly(input, context = {}) {
3
+ export function parseOnly(input, context) {
4
4
  input = tokens(input, context);
5
5
 
6
6
  let token, value;
@@ -54,7 +54,7 @@ export function parseOnly(input, context = {}) {
54
54
  return parser.expression(0);
55
55
  }
56
56
 
57
- export function parse(input, context) {
57
+ export function parse(input, context={}) {
58
58
  const result = parseOnly(input, context);
59
59
  return result.eval ? result.eval(result, context.root, context) : result;
60
60
  }
@@ -1,2 +1,2 @@
1
- export function parseOnly(input: any, context?: {}): any;
2
- export function parse(input: any, context: any): any;
1
+ export function parseOnly(input: any, context: any): any;
2
+ export function parse(input: any, context?: {}): any;