转:
Need For Speed: Nodejs Module In C++
Introduction
The reason can't be more simple: the need for speed.
According to a simple test between node-uuid and C++ uuid, the truth was told: C++ is faster.
The time consumptions of 1M generations of uuid is almost 3s(node-uuid) vs. 0.3s(C++ modules based on boost uuid).
So, the advices is: crucial module should be written in C++, if you have time for this.
node-uuid Module in C++
node-uuid.h
#ifndef NODE_UUID_H
#define NODE_UUID_H
using namespace v8;
#define NODE_UUID_CLS_NAME "nodeUuid"
namespace igame
{
namespace uuid {
void initialize(Handle