Skip to content

Instantly share code, notes, and snippets.

#include "message_listener.h"
// This function is called in the event loop when "uv_async_send(&AW->async)" is executed in "msg_listener.h".
void invokeHandlers(uv_async_t *async){
Isolate * isolate = Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
// Get required data from async handler.
// Reference: "AW->async.data = AW;" in "listenMessage".
AsyncWork *work = static_cast<AsyncWork*>(async->data);
@gx578007
gx578007 / searching_benchmark.cpp
Created July 23, 2017 15:15
An sample code to benchmark searching performance.
#include <vector>
#include <set>
#include <unordered_set>
#include <cassert>
#include <iostream>
using namespace std;
static const int tries = 10000000;
uint64_t rand64() { return (((uint64_t)rand())<<32) | (uint64_t)rand(); }