Using a var
instead of a let
in a for loop was a game changer with Node.js 6 but now it's merely the same performances.
for (var i = 0; i < 10000; i++) {
// ...
}
for (let i = 0; i < 10000; i++) {
npm i benchmark
results
simple function call x 962,129 ops/sec ±2.62% (79 runs sampled)
object function call x 900,959 ops/sec ±2.13% (89 runs sampled)
Fastest is simple function call
Around 0.1 ms for 1000 calls
Immutability has a cost, here is how much
object - vanilla immutable x 903,841 ops/sec ±5.33% (77 runs sampled)
object - immutable.js x 1,672,774 ops/sec ±1.68% (89 runs sampled)
object - mutable x 546,235,424 ops/sec ±0.84% (83 runs sampled)
array - vanilla immutable x 4,855,761 ops/sec ±1.55% (91 runs sampled)
array - immutable.js x 618,146 ops/sec ±3.56% (85 runs sampled)
array - mutable x 9,849,954 ops/sec ±4.00% (85 runs sampled)
const {Benchmark} = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
const justClone = require('just-clone'); | |
const fastClone = require('fast-clone'); | |
const lodashClone = require('lodash').cloneDeep; | |
const stringifyParse = o => JSON.parse(JSON.stringify(o)); | |
const smallObject = { | |
name: 'Aschen', |
This is a standalone migration script to export and imports Elasticsearch Stored Scripts.
Export scripts from your ES cluster:
node migrate.js export http://localhost:9200
/** | |
$ node node/reflect.js | |
Reflect x 3,102,490 ops/sec ±5.31% (78 runs sampled) | |
Normal x 61,204,978 ops/sec ±5.73% (86 runs sampled) | |
Fastest is Normal | |
*/ | |
const {Benchmark} = require('benchmark'); | |
var suite = new Benchmark.Suite; |
const {Benchmark} = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
function monomorphic (person) { | |
const array = []; | |
for (let i = 10; i--; ) { | |
array.push(person.age * i); | |
} |
Usage:
redis-cli --eval clean-keys.lua <mode> <days>
redis-cli --eval clean-keys.lua count 1
redis-cli --eval clean-keys.lua print 1
redis-cli --eval clean-keys.lua delete 1
For example, redis-cli --eval clean-keys.lua count 2
will return the number of keys expiring in more than 2 days
app.controller.register('redirect', { | |
actions: { | |
proxy: { | |
handler: async request => { | |
const { css, js, img, fonts } = request.input.args; | |
let url; | |
let contentType; | |
if (css) { | |
url = `http://console.kuzzle.io/css/${css}` |
class KuzzlePlugin { | |
init (config, context) { | |
this.pipes = { | |
'index:afterList': 'restrictIndexes', | |
'collection:afterList': 'restrictCollections' | |
}; | |
} | |