Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-message/enum file output #44

Merged
merged 7 commits into from
Jan 10, 2023
Merged

Per-message/enum file output #44

merged 7 commits into from
Jan 10, 2023

Conversation

piotr-oles
Copy link
Owner

⚠️ This is a breaking change

With this PR, the as-proto-gen package has made a change in the way it nests messages in the output. Instead of using namespace, it will now generate a separate .ts file for each message or enum, and use ESM modules to connect them. This update brings better compatibility with current web practices and helps to avoid excessively large output files.

@piotr-oles piotr-oles added the major Increment the major version when merged label Jan 8, 2023
@piotr-oles piotr-oles self-assigned this Jan 8, 2023
@github-actions
Copy link

github-actions bot commented Jan 8, 2023

Benchmark results:

yarn run v1.22.19
$ yarn bench:prepare && yarn bench:run
$ node bench/prepare.js
Generating AssemblyScript protobuf file...
Building AssemblyScript bench file...
$ node bench/index.cjs
benchmarking encoding performance ...

as-proto x 1,037,910 ops/sec ±0.97% (84 runs sampled)
protobuf.js x 408,434 ops/sec ±1.48% (82 runs sampled)
JSON x 339,113 ops/sec ±1.24% (84 runs sampled)
google-protobuf x 282,798 ops/sec ±1.51% (83 runs sampled)

               as-proto was fastest
            protobuf.js was 60.8% ops/sec slower (factor 2.6)
                   JSON was 67.4% ops/sec slower (factor 3.1)
        google-protobuf was 72.9% ops/sec slower (factor 3.7)

benchmarking decoding performance ...

as-proto x 747,803 ops/sec ±1.45% (87 runs sampled)
protobuf.js x 1,112,705 ops/sec ±1.16% (86 runs sampled)
JSON x 367,301 ops/sec ±1.29% (85 runs sampled)
google-protobuf x 267,876 ops/sec ±1.23% (88 runs sampled)

            protobuf.js was fastest
               as-proto was 33.0% ops/sec slower (factor 1.5)
                   JSON was 67.0% ops/sec slower (factor 3.0)
        google-protobuf was 75.9% ops/sec slower (factor 4.2)

benchmarking combined performance ...

as-proto x 452,167 ops/sec ±1.29% (87 runs sampled)
protobuf.js x 315,569 ops/sec ±1.79% (84 runs sampled)
JSON x 164,277 ops/sec ±1.38% (85 runs sampled)
google-protobuf x 111,215 ops/sec ±1.03% (87 runs sampled)

               as-proto was fastest
            protobuf.js was 30.5% ops/sec slower (factor 1.4)
                   JSON was 63.7% ops/sec slower (factor 2.8)
        google-protobuf was 75.3% ops/sec slower (factor 4.1)

Done in 74.73s.

@piotr-oles
Copy link
Owner Author

@pienkowb This PR addresses some of the issues from #22. Is this enough for you to use this package, or do you need these _export.ts files?

@pienkowb
Copy link
Contributor

pienkowb commented Jan 9, 2023

@piotr-oles I will check this. Thanks for letting me know!

@piotr-oles piotr-oles merged commit 9296ff1 into main Jan 10, 2023
@piotr-oles piotr-oles deleted the feature/file-output branch January 10, 2023 19:46
@github-actions
Copy link

🚀 PR was released in v1.0.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Increment the major version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants