Skip to content

Instantly share code, notes, and snippets.

@vctqs1
Last active May 24, 2023 04:52
Show Gist options
  • Save vctqs1/0d1d696d8b1ee5f8273aff96439cb2ae to your computer and use it in GitHub Desktop.
Save vctqs1/0d1d696d8b1ee5f8273aff96439cb2ae to your computer and use it in GitHub Desktop.

Code size comparison

This comparison between Connect-Web and gRPC-web

We generated code for the proto using protoc-gen-grpc-web and protoc-gen-connect-es. We then bundled a client for the service (see the client's PR) with vite, compressed it as a web server would usually do.

manabuf-syllabus-ts proto

code generator bundle size compressed
connect 819.60 kB 87.39 kB
grpc-web 3,625.92 kB 261.09 kB

What I did:

I tried to use glob import to import all files from manabuf-syllabus proto

// grpc-web
const modules = import.meta.glob("../../../../../node_modules/manabuf-syllabus/**/*.js", {
    eager: true,
});
console.log("===", modules);

// connect-web
const modules = import.meta.glob("../../../../../node_modules/manabuf-syllabus-v2/**/*.ts", {
    eager: true,
});
console.log("===", modules);

How to use connect

Notes

The generated proto PR will create directly on school-portal-admin with the prefix [connect-bufbuild][achirecture] (for example) and our repo only keeps the latest three PRs, it will auto-close the stale PRs as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment