/node_amf_cc

Fast native C++ implementation of AMF (AMF3 only).

Primary LanguageC++MIT LicenseMIT

node_amf_cc

https://www.npmjs.org/package/node_amf_cc

NodeJS addon written in C++ which implements the AMF 3 specification. This implements nearly all the AMF3 features of amflib but with at least an order of magnitude better performance for long tail payloads.

Written as part of the Eleven Giants project.

Installation:

npm install node_amf_cc

Usage:

var amfcc = require('node_amf_cc');

var encoded = amfcc.serialize({foo: 'bar'});
var decoded = amfcc.deserialize(encoded);
console.log(decoded.value);  // prints {foo: 'bar'}
console.log(decoded.consumed);  

Benchmark results from my machine focusing on tail payloads:

amflib/deserialize x 4.29 ops/sec ±2.02% (15 runs sampled)
amfcc/deserialize x 42.70 ops/sec ±2.37% (57 runs sampled)
amflib/serialize x 2.71 ops/sec ±2.26% (11 runs sampled)
amfcc/serialize x 41.40 ops/sec ±3.30% (56 runs sampled)

To compile the addon from source:

$ node-gyp configure
$ node-gyp build

To run feature tests:

$ npm install amflib should
$ node tests/should.js

To run benchmarks:

$ npm install amflib benchmark segfault-handler
$ node tests/benchmark.js

No plans to support:

  • AMF 0 specification
  • XMLDocument Type
  • Associative (ECMA) arrays
  • XML Type
  • ByteArray type
  • Vector type
  • Dictionary type
  • Externalizable traits (variant of Object type)