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
'use strict'; | |
const MAX_DEPTH = 4; | |
const fs = require('fs'); | |
const print = process._rawDebug; | |
const sep = require('path').sep; | |
const tmpdir = require('os').tmpdir() + sep + 'data-file-bench-' + genName(); | |
const file_list = newDir(); | |
var current_dir = file_list; |
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 <fcntl.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#if defined(__unix__) || defined(__unix) || \ | |
(defined(__APPLE__) && defined(__MACH__)) | |
#include <unistd.h> | |
#endif |
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
{ | |
"targets": [{ | |
"target_name": "addon", | |
"sources": [ "main.cc" ] | |
}] | |
} |
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
'use strict'; | |
const print = process._rawDebug; | |
const ITER = 1e6; | |
var t = process.hrtime(); | |
(function runner(i) { | |
if (i > ITER) return printTime(); | |
// Slowest |
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
diff --git a/src/stream_base.h b/src/stream_base.h | |
index faddee8..3592975 100644 | |
--- a/src/stream_base.h | |
+++ b/src/stream_base.h | |
@@ -146,10 +146,14 @@ class StreamResource { | |
const uv_buf_t* buf, | |
uv_handle_type pending, | |
void* ctx); | |
+ typedef void (*DestructCb)(void* ctx); | |
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 <cstdio> | |
#include <type_traits> // std::remove_reference | |
#ifdef USE_TR1_TYPE_TRAITS | |
template <typename T> using remove_reference = std::tr1::remove_reference<T>; | |
#else | |
template <typename T> using remove_reference = std::remove_reference<T>; | |
#endif | |
class Foo { |
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
// map will store all the stack traces recorded at init(). | |
var map = new Map(); | |
var async_hooks = require('async_hooks'); | |
async_hooks.createHook({ init }).enable(); | |
function init(id, type, parentId) { | |
const obj = {}; | |
// Capture the stack trace, omitting the call to init(). | |
Error.captureStackTrace(obj, 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
#include <v8.h> | |
#include <node.h> | |
#include <uv.h> | |
#include <assert.h> | |
#define MICROS_PER_SEC 1e6 | |
static uint64_t cpu_speed_hz; | |
static uint64_t previous_total; | |
static uint64_t previous_time; |
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
'use strict'; | |
const print = process._rawDebug; | |
const ITER = 1e6; | |
const four_nulls = '\u0000\u0000\u0000\u0000'; | |
// Mock object of only strings. | |
const test_obj = { | |
foobarbaz1: Math.random().toString(16).substr(2), | |
foobarbaz2: 'abcdefghijklmnop'.repeat(5), |
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
'use strict'; | |
// Clear disk cache with: | |
// sudo sh -c 'free && sync && echo 3 > /proc/sys/vm/drop_caches && free' | |
const fs = require('fs'); | |
const Module = require('module'); | |
const print = process._rawDebug; | |
const root_dir = process.cwd() + '/a_lot_of_files/'; | |
print('writing files to', root_dir); |