npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pbw-moon

v0.1.5

Published

Another implementation of protobufjs writer

Downloads

14

Readme

pbw-moon

Main npm version

Overview

Another implementation of protobuf writer for protobuf.js, with smaller javascript heap memory usage. Tested on protobufjs v7.2.6.

When to use

  • encode large Javascript objects

How to use

import * as protos from './protos/proto'
import { Writer } from 'pbw-moon'

// pass to the second argument
protos.partialsketch.Layer.encode(p, new Writer()).finish()

Testing

Unit tests and fuzz test

The result of the offical protobuf writer is compared to verify its correctness. See packages/testing-units for details.

Conformance tests

Protobuf has conformance tests for testing the completeness and correctness of Protocol Buffers implementations. Repository protobuf-conformance runs the protocol buffers conformance test suite against various implementations, which include protobuf.js. This repository was forked to test the writer. See protobuf-conformance/impl/protobuf.js for details.

Benchmark

Currently, encoding small objects is slower than the official writer (in Node.js), but encoding large objects (30 MB) is faster. Run pnpm benchmark to see the result.

[Offical] encode bench
time 8552.496789008379 ms
heapTotal increase 10.5 MB

[pbw-moon] encode bench
time 9201.273878991604 ms
heapTotal increase 0 MB

[Offical] encode partialSketch
time 931.2965700030327 ms
heapTotal increase 316 MB

[pbw-moon] encode partialSketch
time 268.0517299771309 ms
heapTotal increase 11 MB

License

Apache-2.0