This file contains hidden or 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
// FROM: | |
class Foo { | |
constructor() { | |
this.bar = this.bar.bind(this); | |
} | |
bar() { | |
return 1; | |
} | |
} |
This file contains hidden or 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
int fibonacci(int n) { | |
int a = 1; | |
int b = 1; | |
while (n-- > 1) { | |
int t = a; | |
a = b; | |
b += t; | |
} |
This file contains hidden or 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
function fiboJs(num){ | |
var a = 1, b = 0, temp; | |
while (num >= 0){ | |
temp = a; | |
a = a + b; | |
b = temp; | |
num--; | |
} |
This file contains hidden or 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
module.exports = (filename) => { | |
return fetch(filename) | |
.then(response => response.arrayBuffer()) | |
.then(buffer => WebAssembly.compile(buffer)) | |
.then(module => { | |
const imports = { | |
env: { | |
memoryBase: 0, | |
tableBase: 0, | |
memory: new WebAssembly.Memory({ |
This file contains hidden or 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
const Benchmark = require('benchmark'); | |
const loadModule = require('./loader'); | |
const {fiboJs, fiboJsRec, fiboJsMemo} = require('./fibo.js'); | |
const suite = new Benchmark.Suite; | |
const numToFibo = 40; | |
window.Benchmark = Benchmark; //Benchmark.js uses the global object internally | |
console.info('Benchmark started'); |
This file contains hidden or 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
(function($0) {var stack = Runtime.stackSave();var str = $0;var ret = 0; | |
if (str !== null && str !== undefined && str !== 0) { // null string | |
// at most 4 bytes per UTF-8 code point, +1 for the trailing '\0' | |
var len = (str.length << 2) + 1; | |
ret = Runtime.stackAlloc(len); | |
stringToUTF8(str, ret, len); | |
};$0=(ret);var ret = cfunc($0);if (typeof EmterpreterAsync === 'object') { assert(!EmterpreterAsync.state, 'cannot start async op with normal JS calling cwrap') }Runtime.stackRestore(stack);return ret}) |
This file contains hidden or 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
cwrap = function cwrap(ident, returnType, argTypes) { | |
argTypes = argTypes || []; | |
var cfunc = getCFunc(ident); | |
// When the function takes numbers and returns a number, we can just return | |
// the original function | |
var numericArgs = argTypes.every(function(type){ return type === 'number'}); | |
var numericRet = (returnType !== 'string'); | |
if ( numericRet && numericArgs) { | |
return cfunc; | |
} |
This file contains hidden or 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 <string.h> | |
#include <stdint.h> | |
#include <limits.h> | |
#define ALIGN (sizeof(size_t)) | |
#define ONES ((size_t)-1/UCHAR_MAX) | |
#define HIGHS (ONES * (UCHAR_MAX/2+1)) | |
#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) | |
size_t strlen(const char *s) |
This file contains hidden or 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
source /Users/zzarcon/emsdk_portable/emsdk_env.sh | |
export LLVM_ROOT=/Users/zzarcon/emsdk_portable/clang/fastcomp/build_incoming_64/bin | |
export NODE_JS=/Users/zzarcon/.nvm/versions/node/v7.4.0/bin/node | |
export EMSCRIPTEN_ROOT=/Users/zzarcon/emsdk_portable/emscripten/incoming | |
export EMSCRIPTEN_NATIVE_OPTIMIZER=/Users/zzarcon/emsdk_portable/emscripten/incoming_64bit_optimizer/optimizer |
This file contains hidden or 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
/** @jsx h */ | |
/* | |
Component A passing custom styles to sk-tags | |
*/ | |
import { Component, h } from 'skatejs'; | |
class A extends Component { | |
renderCallback() { | |
const tagStyles = ` |