-
Libuv has a default thread pool size of 4, and uses a queue to manage access to the thread pool - the upshot is that if you have 5 long-running DB queries all going at the same time, one of them (and any other asynchronous action that relies on the thread pool) will be waiting for those queries to finish before they even get started.
-
Note, however, that tuning UV_THREADPOOL_SIZE may make more sense for a standalone application like a CLI written in Node.js. If you are standing up a bunch of Node.js processes using the cluster module then I would be surprised if tuning UV_THREADPOOL_SIZE was particularly beneficial for you. But if your application resembles the web tooling benchmarks then tuning UV_THREADPOOL_SIZE may help with performance.
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
let bookmarkList = Array.from(document.querySelectorAll('.widget>.vbox')) | |
.map(e => e.shadowRoot) | |
.map(e => e && e.querySelector('.device-page-list')) | |
.find(e => e); | |
let bookmarks = Array.from(bookmarkList.querySelectorAll('.vbox')) | |
.map(e => `<a href="${e.querySelector('x-link').innerHTML}">${e.querySelector('.device-page-title').innerHTML}</a>`); | |
copy('<html><body>' + bookmarks.join('\n') + '</body></html>'); |
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
const deepCopyFunction = (inObject) => { | |
let outObject, value, key | |
if (typeof inObject !== "object" || inObject === null) { | |
return inObject // Return the value if inObject is not an object | |
} | |
// Create an array or object to hold the values | |
outObject = Array.isArray(inObject) ? [] : {} |
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
// Method 1 | |
var isTouchDevice = | |
(('ontouchstart' in window) || | |
(navigator.MaxTouchPoints > 0) || | |
(navigator.msMaxTouchPoints > 0)); | |
if(!isTouchDevice){ | |
console.log('is not touch'); | |
}else{ | |
console.log('is touch'); | |
} |
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
var keepsHisWord; | |
keepsHisWord = true; | |
promise1 = new Promise(function(resolve, reject) { | |
if (keepsHisWord) { | |
resolve("The man likes to keep his word"); | |
} else { | |
reject("The man doesnt want to keep his word"); | |
} | |
}); | |
console.log(promise1); |
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
/* -------------------------------------------------------------------------- */ | |
// All Bootstrap 4 Sass Mixins [Cheat sheet] | |
// Updated to Bootstrap v4.5.x | |
// @author https://anschaef.de | |
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins | |
/* -------------------------------------------------------------------------- */ | |
/* | |
// ########################################################################## */ | |
// New cheat sheet for Bootstrap 5: |
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
/** | |
* setImmediate callbacks are fired off the event loop, once per iteration in the order that they were queued. | |
* So on the first iteration of the event loop, callback A is fired. | |
* Then on the second iteration of the event loop, callback B is fired, then on the third iteration of the event loop callback C is fired, etc. | |
* This prevents the event loop from being blocked and allows other I/O or timer callbacks to be called in the mean time (as is the case of the 0ms timeout, which is fired on the 1st or 2nd loop iteration). | |
*/ | |
setImmediate(function A() { | |
setImmediate(function B() { | |
console.log(1); |
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
# overwrite master with contents of feature branch (feature > master) | |
git checkout feature # source name | |
git merge -s ours master # target name | |
git checkout master # target name | |
git merge feature # source name |
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
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html |
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
// | |
// PrintLocalesController.m | |
// NSFormatterTest | |
// | |
// Created by Maciek Grzybowski on 02.04.2014. | |
// | |
#import "PrintLocalesController.h" | |
@interface PrintLocalesController () |
NewerOlder