300x250 AD TOP

Search This Blog

Paling Dilihat

Powered by Blogger.

Saturday, December 24, 2016

Node js C++ Addon Overload Resolution - Update

Since the last update on December 13th, multiple enhancements have been made, So far I'm happy!

Major changes and improvements:


  • The major performance issue in the tests have been found, when many overloads are added, the engine goes over all of them to find the most suitable one, this takes time and CPU. The first part that needs optimization is probably the determineType function.
  • make_param added overloads and template type specialization for multiple types, which makes the overload creation simpler and more robust.
  • Automatic async function implementation is now simple and straight forward, as long as only c++ typed templated functions are used for This<T> and at<T> (replaces info[]) and SetReturnValue<T>, the function should be able to run async, just note that async functions are executed in libuv's threadpool, which means you'll have to handle locks manually or use thread safe function calls. With locks comes great responsibility, node js libuv threadpool default size is 4 threads, too many waiting threads will either kill or slow down node js significantly.
  • Accessing This, info[] and GetReturnValue will now throw an exception if attempted execution in async, no more crashes if these calls were made by mistake, just a normal v8 exception.
  • Partial logging for what happens in the engine, TRACE for function calls, DEBUG for diagnostics, WARN for something that's not as designed and ERROR for usage mistakes.
Tags:

2 comments:

  1. Nice! Can you elaborate on how you found those perf issues / improvements?

    ReplyDelete
  2. Logging. If you suddenly see the log explode after a function executes, you know there is a problem there...

    ReplyDelete