NodeJs Addon

122c67ce0fdc3f270e8cd9017dca8068?s=47 Ravi Suhag
September 27, 2014

NodeJs Addon

Extending node with C++ using Node Addons

122c67ce0fdc3f270e8cd9017dca8068?s=128

Ravi Suhag

September 27, 2014
Tweet

Transcript

  1. 2.

    Ravi Suhag UI/UX and Data Visualisation Consultant at Harvard University

    • Founder - Inspiration Edge, Infoclot • Developer, Designer, Hardware Hacker, Entrepreneur • Winner of 6 National and Global Hackathons in last year • Worked with Harvard University, Govt. of India, hoppr, Indiamart ! @Ravi_Suhag ravisuhag.com suhag.ravi@gmail.com About the Speaker…
  2. 4.

    Need to know to start building ? ! • V8

    JavaScript, a C++ library for creating objects, calling functions, etc. • lbuv, C event loop library. • NODE-GYP - Build tool
  3. 5.

    V8 ! • Implements ECMA-262 • Runs on OSes which

    uses IA-32, x64, or ARM processors • Enables any C++ application to expose its own objects and functions to JS code. e.g. Adobe Flash,Widgets in Apple's Mac OS X, Yahoo! Widgets
  4. 6.

    libuv • Multi-platform support library with a focus on asynchronous

    I/O. • Developed for use by Node.js • Used by Mozilla's Rust language, Luvit, Julia, pyuv
  5. 10.

    Is this hassle fruitful ? • I have a C++

    library that I’d like to use and I’m not smart enough or don’t have the time to rewrite it. • CPU heavy apps • Super-secret algorithms. - Not really !
  6. 11.

    if possible write it in JS … JS ⟷ C++

    boundary is slow to cross ! function() { return Math.floor(133.7 / Math.PI); } ! • native JS ~83,333,333 calls/s • V8 return ~13,333,333 calls/s • V8 async ~1,745,200 calls/s • thread pool ~83,682 calls/s (0.1%) benchmarking by kaefer