Skip to content

Commit 3325e86

Browse files
committed
Other: Properly removed builtins from bundle; Other: UMD wrapper detects more enviroments + loader test cases
1 parent 2c94b64 commit 3325e86

32 files changed

+686
-571
lines changed

Diff for: .eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"Float64Array": true,
1010
"define": true,
1111
"XMLHttpRequest": true,
12-
"Promise": true
12+
"Promise": true,
13+
"dcodeIO": true
1314
},
1415
"parserOptions": {
1516
"ecmaVersion": 5

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3946e0fefea415f52a16ea7a74109ff40eee9643) Initial upgrade of converters to real generated functions, see [#620](https://github.com/dcodeIO/protobuf.js/issues/620)<br />
55

66
## Fixed
7+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/08cda241a3e095f3123f8a991bfd80aa3eae9400) An enum's default value present as a string looks up using typeDefault, not defaultValue which is an array if repeated<br />
78
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/c7e14b1d684aaba2080195cc83900288c5019bbc) Use common utility for virtual oneof getters and setters in both reflection and static code, see [#644](https://github.com/dcodeIO/protobuf.js/issues/644)<br />
89
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/508984b7ff9529906be282375d36fdbada66b8e6) Use Type.toObject/Message.toObject within converters, see [#641](https://github.com/dcodeIO/protobuf.js/issues/641)<br />
910
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/5bca18f2d32e8687986e23edade7c2aeb6b6bac1) Generate null/undefined assertion in fromObject if actually NOT an enum, see [#620](https://github.com/dcodeIO/protobuf.js/issues/620)<br />
1011

1112
## New
13+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/9b090bb1673aeb9b8f1d7162316fce4d7a3348f0) Switched to own property-aware encoders for compatibility, see [#639](https://github.com/dcodeIO/protobuf.js/issues/639)<br />
1214
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/cda5c5452fa0797f1e4c375471aef96f844711f1) Removed scoping iifes from generated static code<br />
1315
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/def7b45fb9b5e01028cfa3bf2ecd8272575feb4d) Removed even more clutter from generated static code<br />
1416
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/dbd19fd9d3a57d033aad1d7173f7f66db8f8db3e) Removed various clutter from generated static code<br />
1517
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/340d6aa82ac17c4a761c681fa71d5a0955032c8b) Now also parses comments, sets them on reflected objects and re-uses them when generating static code, see [#640](https://github.com/dcodeIO/protobuf.js/issues/640)<br />
1618

1719
## CLI
20+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3cb82628159db4d2aa721b63619b16aadc5f1981) Further improved generated static code style<br />
1821
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/1cc8a2460c7e161c9bc58fa441ec88e752df409c) Made sure that static target's replacement regexes don't match fields<br />
1922
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/d4272dbf5d0b2577af8efb74a94d246e2e0d728e) Also accept (trailing) triple-slash comments for compatibility with protoc-gen-doc, see [#640](https://github.com/dcodeIO/protobuf.js/issues/640)<br />
2023
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/508984b7ff9529906be282375d36fdbada66b8e6) Replace all occurencies of types[%d].values in static code, see [#641](https://github.com/dcodeIO/protobuf.js/issues/641)<br />
@@ -27,6 +30,11 @@
2730
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/079388ca65dfd581d74188a6ae49cfa01b103809) Updated converter documentation<br />
2831

2932
## Other
33+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/2c94b641fc5700c8781ac0b9fe796debac8d6893) Call hasOwnProperty builtin as late as possible decreasing the probability of having to call it at all (perf)<br />
34+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/818bcacde267be70a75e689f480a3caad6f80cf7) Slightly hardened codegen sprintf<br />
35+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/818bcacde267be70a75e689f480a3caad6f80cf7) Significantly improved uint32 write performance<br />
36+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/b5daa272407cb31945fd38c34bbef7c9edd1db1c) Cleaned up test case data and removed unused files<br />
37+
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/f46ee79b0a5b9dfd3176d8dfbb430cfaca8ed150) Updated dist files and types to reflect recent changes<br />
3038
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/c280a4a18c6d81c3468177b2ea58ae3bc4f25e73) Removed now useless trailing comment checks, see [#640](https://github.com/dcodeIO/protobuf.js/issues/640)<br />
3139
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3f6ffd01c3cb7d7fc4129c45dc803abb5211a1fd) Restrict comment parsing for static code to explicit /**-blocks because old protos may generate a lot of nonsense otherwise, see [#640](https://github.com/dcodeIO/protobuf.js/issues/640)<br />
3240
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a4954ed2b63e349c96acc5c471241a5abb79854d) Added semver to dev/cli dependencies<br />

Diff for: README.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -364,37 +364,45 @@ The package includes a benchmark that tries to compare performance to native JSO
364364
```
365365
benchmarking encoding performance ...
366366
367-
Type.encode to buffer x 521,803 ops/sec ±0.84% (88 runs sampled)
368-
JSON.stringify to string x 300,362 ops/sec ±1.11% (86 runs sampled)
369-
JSON.stringify to buffer x 169,413 ops/sec ±1.49% (86 runs sampled)
367+
Type.encode to buffer x 547,361 ops/sec ±0.27% (94 runs sampled)
368+
JSON.stringify to string x 310,848 ops/sec ±0.73% (92 runs sampled)
369+
JSON.stringify to buffer x 173,608 ops/sec ±1.51% (86 runs sampled)
370370
371371
Type.encode to buffer was fastest
372-
JSON.stringify to string was 42.6% slower
373-
JSON.stringify to buffer was 67.7% slower
372+
JSON.stringify to string was 43.5% slower
373+
JSON.stringify to buffer was 68.7% slower
374374
375375
benchmarking decoding performance ...
376376
377-
Type.decode from buffer x 1,325,308 ops/sec ±1.46% (88 runs sampled)
378-
JSON.parse from string x 283,907 ops/sec ±1.39% (86 runs sampled)
379-
JSON.parse from buffer x 255,372 ops/sec ±1.28% (88 runs sampled)
377+
Type.decode from buffer x 1,294,378 ops/sec ±0.86% (90 runs sampled)
378+
JSON.parse from string x 291,944 ops/sec ±0.72% (92 runs sampled)
379+
JSON.parse from buffer x 256,325 ops/sec ±1.50% (90 runs sampled)
380380
381381
Type.decode from buffer was fastest
382-
JSON.parse from string was 78.6% slower
383-
JSON.parse from buffer was 80.7% slower
382+
JSON.parse from string was 77.4% slower
383+
JSON.parse from buffer was 80.3% slower
384384
385385
benchmarking combined performance ...
386386
387-
Type to/from buffer x 269,719 ops/sec ±0.87% (91 runs sampled)
388-
JSON to/from string x 122,878 ops/sec ±1.59% (87 runs sampled)
389-
JSON to/from buffer x 89,310 ops/sec ±1.01% (88 runs sampled)
387+
Type to/from buffer x 254,126 ops/sec ±1.13% (91 runs sampled)
388+
JSON to/from string x 122,896 ops/sec ±1.29% (90 runs sampled)
389+
JSON to/from buffer x 88,005 ops/sec ±0.87% (89 runs sampled)
390390
391391
Type to/from buffer was fastest
392-
JSON to/from string was 54.8% slower
393-
JSON to/from buffer was 66.9% slower
392+
JSON to/from string was 51.7% slower
393+
JSON to/from buffer was 65.3% slower
394394
395395
benchmarking verifying performance ...
396396
397-
Type.verify x 5,857,856 ops/sec ±0.82% (91 runs sampled)
397+
Type.verify x 6,246,765 ops/sec ±2.00% (87 runs sampled)
398+
399+
benchmarking message from object performance ...
400+
401+
Type.fromObject x 2,892,973 ops/sec ±0.70% (92 runs sampled)
402+
403+
benchmarking message to object performance ...
404+
405+
Type.toObject x 3,601,738 ops/sec ±0.72% (93 runs sampled)
398406
```
399407

400408
Note that JSON is a native binding nowadays and as such is about as fast as it possibly can get. So, how can protobuf.js be faster?

Diff for: dist/noparse/protobuf.js

+14-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/noparse/protobuf.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/noparse/protobuf.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/noparse/protobuf.min.js.gz

-2 Bytes
Binary file not shown.

Diff for: dist/noparse/protobuf.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.js

+14-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.min.js.gz

41 Bytes
Binary file not shown.

Diff for: dist/protobuf.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/runtime/protobuf.js

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/runtime/protobuf.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/runtime/protobuf.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/runtime/protobuf.min.js.gz

-5 Bytes
Binary file not shown.

Diff for: dist/runtime/protobuf.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"pages": "node scripts/pages",
3535
"prepublish": "node scripts/prepublish",
3636
"prof": "node bench/prof",
37-
"test": "tape -r ./lib/tape-adapter tests/*.js | tap-spec",
37+
"test": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js | tap-spec",
3838
"types": "node bin/pbts --main --global protobuf --out index.d.ts src && tsc tests/typescript.ts --lib es2015 --noEmit --strictNullChecks && tsc tests/data/test.ts --lib es2015 --noEmit --strictNullChecks",
3939
"zuul": "zuul --ui tape --no-coverage --concurrency 4 -- tests/*.js",
4040
"zuul-local": "zuul --ui tape --concurrency 1 --local 8080 --disable-tunnel -- tests/*.js",
@@ -72,7 +72,6 @@
7272
"git-semver-tags": "^1.1.2",
7373
"glob": "^7.1.1",
7474
"gulp": "^3.9.1",
75-
"gulp-gzip": "^1.4.0",
7675
"gulp-header": "^1.8.8",
7776
"gulp-if": "^2.0.1",
7877
"gulp-sourcemaps": "^2.4.0",

0 commit comments

Comments
 (0)