Skip to content

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

License

Notifications You must be signed in to change notification settings

chatziko/node_amf_cc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • XML Type
  • ByteArray type
  • Vector type
  • Dictionary type
  • Externalizable traits (variant of Object type)

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 76.5%
  • JavaScript 22.5%
  • Python 1.0%