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
macro_rules! err { | |
($i:expr, $kind: expr) => { | |
IResult::Error(error_position!($kind, $i)) | |
}; | |
} | |
macro_rules! alt_switch { | |
($i:expr, $($lhs_mac:ident ! ( $($lhs_arg:tt)* ) $(as $lhs_binding:pat)* => $rhs_mac:ident ! ( $($rhs_arg:tt)* ) |)+ _ => $def_mac:ident ! ( $($def_arg:tt)* )) => {{ | |
$(if let IResult::Done(i, $($lhs_binding,)* ..) = $lhs_mac ! ( $i, $($lhs_arg)* ) { | |
$rhs_mac ! ( i, $($rhs_arg)* ) |
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
{ | |
"module": { | |
"inner": { | |
"lo": 0, | |
"hi": 69 | |
}, | |
"items": [{ | |
"ident": "", | |
"attrs": [{ | |
"id": { |
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
// See https://jsperf.com/acorn-top-level-parsing-experiment/1 for example | |
acorn.plugins.top_level = function (instance) { | |
// Could skip other things as well, but this | |
// is where the most time can be saved | |
instance.parseBlock = function () { | |
var node = this.startNode(); | |
var length = this.context.length; | |
do { | |
this.next(); |
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
// consider the following code | |
// a.js | |
class A extends Component { | |
static B = undefined; | |
state = { B : A.B }; | |
componentWillMount() { | |
A.B || import('./b.js').then(B => { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>regexgen</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Untitled benchmark</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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'; | |
var jBinary = require('jbinary'); | |
var FLGTypeSet = { | |
'jBinary.all': ['array', 'LOG_T'], | |
'jBinary.littleEndian': true, | |
STEP_T: { | |
tempSp: 'float', |
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
PS C:\Users\Ingvar> node -e "function f() { eval('1') } for (var i=0; i < 10000; i++) f()" --trace-opt | |
[disabled optimization for 0000035F6F466C59 <SharedFunctionInfo SAR>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F465B81 <SharedFunctionInfo ADD>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F466E69 <SharedFunctionInfo SHR>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F467069 <SharedFunctionInfo IN>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F4ED7C9 <SharedFunctionInfo NativeModule.require>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F4ED721 <SharedFunctionInfo NativeModule>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F466669 <SharedFunctionInfo BIT_OR>, reason: Call to a JavaScript runtime function] | |
[disabled optimization for 0000035F6F466119 <SharedFunctionInfo MUL>, reas |
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
{ | |
"tests": [ | |
{ | |
"description": "'Hello'</script>BAR", | |
"initialStates": ["script data state"], | |
"lastStartTag": "script", | |
"input": "'Hello'</script>BAR", | |
"output": [ | |
["Character", "'Hello'"], | |
["EndTag", "script"], |
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
// Chrome extensions/apps API | |
// Uses Callback #3: (data => { let err = chrome.runtime.lastError; ... }) for Chrome API | |
// Uses Callback #2: (data => { ... }, err => { ... }) for FileSystem API (also Chrome-specific!) | |
// Uses Events onload and onerror for File API (HTML5) | |
// All implemented within one vendor for different APIs (sic!) | |
chrome.fileSystem.chooseEntry({ type: 'openFile' }, fileEntry => { | |
if (chrome.runtime.lastError) { | |
console.error('Error in file open dialog:', chrome.runtime.lastError); | |
} else { |