Created
September 17, 2010 22:48
-
-
Save wereHamster/585102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <v8.h> | |
#include <node.h> | |
#include <iostream> | |
using namespace v8; | |
static void init (Handle<Object> target) { | |
int i; | |
for (i = 0; i < 10000000; ++i) { | |
HandleScope scope; | |
Local<Value> val = Object::New(); | |
Local<String> str = val->ToString(); | |
char buffer[str->Length()+1]; | |
str->WriteAscii(buffer); | |
#if 0 | |
std::string s(buffer); | |
std::cout << s << std::endl; | |
#else | |
printf("%s\n", buffer); | |
#endif | |
fflush(stdout); | |
} | |
std::cout << "End" << std::endl; | |
fflush(stdout); | |
exit(0); | |
} | |
NODE_MODULE(test, init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./build/default/test'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_options(opt): | |
opt.tool_options("compiler_cxx") | |
def configure(conf): | |
conf.check_tool("compiler_cxx") | |
conf.check_tool("node_addon") | |
def build(bld): | |
obj = bld.new_task_gen("cxx", "shlib", "node_addon") | |
obj.target = "test" | |
obj.source = "test.cc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment