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

notepack

v0.0.2

Published

A fast Node.js implementation of the latest MessagePack spec

Downloads

163

Readme

notepack

Build Status Coverage Status

A fast Node.js implementation of the latest MessagePack spec.

Notes

  • This implementation is not backwards compatible with those that use the older spec. It is recommended that this library is only used in isolated systems.
  • undefined is encoded as fixext 1 [0, 0], i.e. <Buffer d4 00 00>
  • Date objects are encoded as fixext 8 [0, ms], e.g. new Date('2000-06-13T00:00:00.000Z') => <Buffer d7 00 00 00 00 df b7 62 9c 00>

Install

npm install notepack

Usage

var notepack = require('notepack');

var encoded = notepack.encode({ foo: 'bar'}); // <Buffer 81 a3 66 6f 6f a3 62 61 72>
var decoded = notepack.decode(encoded); // { foo: 'bar' }

Performance

Performance is currently comparable to msgpack-node (which presumably needs optimizing and suffers from JS-native overhead) and is significantly faster than other implementations. Several micro-optimizations are used to improve the performance of short string and Buffer operations.

The ./benchmarks/run output on my machine is:

Encoding (this will take a while):
+----------------------------+-----------------+-----------------+----------------+---------------+
|                            │ tiny            │ small           │ medium         │ large         |
+----------------------------+-----------------+-----------------+----------------+---------------+
| notepack                   │ 758,340 ops/sec │ 172,415 ops/sec │ 18,614 ops/sec │ 262 ops/sec   |
+----------------------------+-----------------+-----------------+----------------+---------------+
| msgpack-js                 │ 100,768 ops/sec │ 27,229 ops/sec  │ 3,044 ops/sec  │ 93.47 ops/sec |
+----------------------------+-----------------+-----------------+----------------+---------------+
| msgpack-node               │ 206,825 ops/sec │ 107,619 ops/sec │ 20,362 ops/sec │ 284 ops/sec   |
+----------------------------+-----------------+-----------------+----------------+---------------+
| JSON.stringify (to Buffer) │ 528,632 ops/sec │ 154,229 ops/sec │ 12,023 ops/sec │ 7.82 ops/sec  |
+----------------------------+-----------------+-----------------+----------------+---------------+
Decoding (this will take a while):
+--------------------------+-------------------+-----------------+----------------+---------------+
|                          │ tiny              │ small           │ medium         │ large         |
+--------------------------+-------------------+-----------------+----------------+---------------+
| notepack                 │ 756,003 ops/sec   │ 163,630 ops/sec │ 15,771 ops/sec │ 144 ops/sec   |
+--------------------------+-------------------+-----------------+----------------+---------------+
| msgpack-js               │ 425,628 ops/sec   │ 101,821 ops/sec │ 10,117 ops/sec │ 123 ops/sec   |
+--------------------------+-------------------+-----------------+----------------+---------------+
| msgpack-node             │ 717,093 ops/sec   │ 165,781 ops/sec │ 23,506 ops/sec │ 155 ops/sec   |
+--------------------------+-------------------+-----------------+----------------+---------------+
| JSON.parse (from Buffer) │ 1,441,579 ops/sec │ 396,923 ops/sec │ 28,594 ops/sec │ 33.94 ops/sec |
+--------------------------+-------------------+-----------------+----------------+---------------+
* Note that JSON is provided as an indicative comparison only

License

MIT