@formatjs/icu-messageformat-parser 3.3.0 → 3.5.0

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
@@ -4,6 +4,10 @@ Hand-written ICU MessageFormat parser with compatible output as
4
4
  [`intl-messageformat-parser`](https://www.npmjs.com/package/intl-messageformat-parser)
5
5
  but 6 - 10 times as fast.
6
6
 
7
+ ## Benchmarks
8
+
9
+ ### JavaScript/TypeScript Parser
10
+
7
11
  ```
8
12
  $ bazel run //packages/icu-messageformat-parser/benchmark:benchmark
9
13
  complex_msg AST length 2599
@@ -11,8 +15,22 @@ normal_msg AST length 400
11
15
  simple_msg AST length 79
12
16
  string_msg AST length 36
13
17
 
14
- complex_msg x 58,910 ops/sec ±0.33%
15
- normal_msg x 405,440 ops/sec ±0.53%
16
- simple_msg x 2,592,098 ops/sec ±0.44%
17
- string_msg x 4,511,129 ops/sec ±2.22%
18
+ complex_msg: 23.85 µs (41,931 ops/sec)
19
+ normal_msg: 3.27 µs (306,177 ops/sec)
20
+ simple_msg: 0.60 µs (1,675,766 ops/sec)
21
+ string_msg: 0.32 µs (3,113,287 ops/sec)
22
+ ```
23
+
24
+ ### Rust Parser (WASM)
25
+
26
+ The Rust parser (optimized build) is **2.6-3.7x faster** than the JavaScript parser:
27
+
18
28
  ```
29
+ $ bazel run -c opt //crates/icu_messageformat_parser:comparison_bench
30
+ complex_msg: 9.22 µs (2.59x faster than JS)
31
+ normal_msg: 1.14 µs (2.87x faster than JS)
32
+ simple_msg: 163 ns (3.68x faster than JS)
33
+ string_msg: 118 ns (2.71x faster than JS)
34
+ ```
35
+
36
+ The Rust parser is also 10-11% faster than the SWC ICU MessageFormat parser.
package/index.d.ts CHANGED
@@ -3,6 +3,5 @@ import { type MessageFormatElement } from "./types.js";
3
3
  export declare function parse(message: string, opts?: ParserOptions): MessageFormatElement[];
4
4
  export * from "./types.js";
5
5
  export type { ParserOptions };
6
- // only for testing
7
6
  export declare const _Parser: typeof Parser;
8
7
  export { isStructurallySame } from "./manipulator.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/icu-messageformat-parser",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -11,9 +11,9 @@
11
11
  "./manipulator.js": "./manipulator.js"
12
12
  },
13
13
  "dependencies": {
14
- "tslib": "^2.8.0",
15
- "@formatjs/ecma402-abstract": "3.0.8",
16
- "@formatjs/icu-skeleton-parser": "2.0.8"
14
+ "tslib": "^2.8.1",
15
+ "@formatjs/ecma402-abstract": "3.1.0",
16
+ "@formatjs/icu-skeleton-parser": "2.1.0"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -1,3 +1,2 @@
1
- // @generated from regex-gen.ts
2
1
  export declare const SPACE_SEPARATOR_REGEX: RegExp;
3
2
  export declare const WHITE_SPACE_REGEX: RegExp;
@@ -1,3 +1 @@
1
- // @generated from time-data-gen.ts
2
- // prettier-ignore
3
1
  export declare const timeData: Record<string, string[]>;