let preElem = document.getElementsByClassName('display')[0];
let statusElem = document.getElementsByClassName('status')[0];
let alpha = 'abcdefghijklmnopqrstuvwxyz';
alpha += alpha.toUpperCase();
let everyPossibleString = function*() {
yield '';
for (let prefix of everyPossibleString()) for (let char of alpha) yield `${prefix}${char}`;
};
(async () => {
let abc = 'This is the ABC variable :-|';
let neato = 'This is the NEATO variable :-)';
let swell = 'This is the SWELL variable :-D';
let ignoreRegex = /^(?:t(?:his|op)|self|window)$/;
let results = {};
let batch = 25000;100;
let waitMs = 1000;25;
let count = 0;
let startStr = null;
let t = null;
for (let bruteStr of everyPossibleString()) {
if (t === null) t = Date.now();
// Some property accesses cause problems within stackoverflow's snippet system
// This lets us bypass these problematic properties
if (ignoreRegex.test(bruteStr)) continue;
if (bruteStr === '') continue;
if (startStr === null) startStr = bruteStr;
try { results[bruteStr] = eval(bruteStr); } catch(err) {}
let t = Date.now();
if (count++ >= batch) {
statusElem.innerHTML = `Did batch of ${batch} from ${startStr} -> ${bruteStr} in ${waitMs.toFixed(0)}ms`;
preElem.innerHTML = JSON.stringify(results, null, 2);
count = 0;
startStr = null;
await new Promise(r => setTimeout(r, waitMs));
}
let dur = (Date.now() - t) + 2;5; // +2ms+5ms for breathing space
waitMs let estimatedMaxBatch = batch * (waitMs / dur);
t = null;
batch = Math.round(batch * 0.8 + durestimatedMaxBatch * 0.2);
await new Promise(r => setTimeout(r, waitMs));
}
}
console.log('Done...'); // Will literally never happen
})();
html, body { position: fixed; left: 0; top: 0; right: 0; bottom: 0; margin: 0; padding: 0; overflow: hidden }
.display {
position: fixed;
box-sizing: border-box;
left: 0; top: 0;
bottom: 30px; right: 0;
overflow-y: scroll;
white-space: pre;
font-family: monospace;
padding: 10px;
box-shadow: inset 0 0 10px 1px rgba(0, 0, 0, 0.3);
}
.status {
position: fixed;
box-sizing: border-box;
left: 0; bottom: 0px; right: 0; height: 30px; line-height: 30px;
padding: 0 10px;
background-color: rgba(0, 0, 0, 1);
color: rgba(255, 255, 255, 1);
font-family: monospace;
}
<div class="display"></div>
<div class="status"></div>