Skip to content

Instantly share code, notes, and snippets.

@wereHamster
Created September 17, 2010 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wereHamster/585102 to your computer and use it in GitHub Desktop.
Save wereHamster/585102 to your computer and use it in GitHub Desktop.
#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);
require('./build/default/test');
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