If you don't know anything about JSON, please, spend some time on learning JSON structure.
Recommended sources:
var syncDep; | |
function getLottery() { | |
return new Promise((resolve, reject) =>{ | |
if (syncDep === undefined) { //check of we already have this data...if not THEN go get | |
setTimeout(function() { | |
syncDep = [1,22,34,56,5]; | |
resolve(syncDep); | |
}, 2000); | |
} else { |
var start = new Date(); | |
var hrstart = process.hrtime(); | |
setTimeout(function (argument) { | |
// execution time simulated with setTimeout function | |
var end = new Date() - start, | |
hrend = process.hrtime(hrstart); | |
console.info("Execution time: %dms", end); | |
console.info("Execution time (hr): %ds %dms", hrend[0], hrend[1]/1000000); |
If you don't know anything about JSON, please, spend some time on learning JSON structure.
Recommended sources:
In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.
TEST NAME | SECONDS | OP/SEC |
---|---|---|
Rosetta2 | 191.654 sec | 1.96 MOp/s |
Intel i7-4790K (imac 2014) | 156.791 sec | 2.39 MOp/s |
Intel i5-8500B (mini 2018) | 141.381 sec | 2.65 MOp/s |
ARM m1 | 43.745 sec | 8.58 MOp/s |
// This injects a box into the page that moves with the mouse; | |
// Useful for debugging | |
async function installMouseHelper(page) { | |
await page.evaluateOnNewDocument(() => { | |
// Install mouse helper only for top-level frame. | |
if (window !== window.parent) | |
return; | |
window.addEventListener('DOMContentLoaded', () => { | |
const box = document.createElement('puppeteer-mouse-pointer'); | |
const styleElement = document.createElement('style'); |