Skip to content

Instantly share code, notes, and snippets.

Avatar

Taketoshi Aono brn

View GitHub Profile
View v8-number-parsing-benchmark-generator.js
/**
* @fileoverview
* @author Taketoshi Aono
*/
const fs = require('fs');
const LOOP_COUNT = 1e6;
function generatorBenchmark(filename, cb) {
const fd = fs.openSync(filename, 'w');
View object-entries-values-slow-path-bench.js
if (typeof console === 'undefined') console = {log:print};
function forIn(o) {
let result = 0;
for (const key in o) {
if (Object.prototype.hasOwnProperty.call(o, key)) {
result += key.length + o[key].length;
}
}
return result;
View object-entries-values-fast-path-bench.js
if (typeof console === 'undefined') console = {log:print};
function forIn(o) {
let result = 0;
for (const key in o) {
if (Object.prototype.hasOwnProperty.call(o, key)) {
result += key.length + o[key].length;
}
}
return result;
View meltdown.s
; rcx = kernel address
; rbx = probe array
retry:
mov al, byte [rcx]
shl rax, 0xc
jz retry
mov rbx, qword [rbx + rax]
View v8-jsobjects.cc
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
const int kHeapObjectTag = 1;
const int kHeapObjectTagSize = 2;
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
inline static bool HasHeapObjectTag(const char* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
View generator.js
const hello = () => new Promise(resolve => setTimeout(() => resolve("hello"), 300));
const world = () => new Promise(resolve => setTimeout(() => resolve("world"), 300));
co(function* () {
var hello = yield hello();
var world = yield world();
return `${hello} ${world}`;
}).then(word => console.log(value));
@brn
brn / SimplePromise.js
Last active May 18, 2017
Minimum Promise implementation for explanation of promise.
View SimplePromise.js
/**
* @fileoverview
* @author Taketoshi Aono
*/
(function(Promise) {
if (typeof module === 'object' && module.exports) {
module.exports = Promise;
} else if (typeof window === 'object') {
window.SimplePromise = Promise;
View example.tsx
import * as React from 'react';
import {
Observable
} from 'rxjs/Rx';
import {
createModule,
component,
IOResponse,
Tags as T,
run,
You can’t perform that action at this time.