manually inlining validator functions improves performance
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- performance
Direzione di ricerca
Inizia con benchmark/path/isAbsolute-posix.js e riproduci le due esecuzioni del benchmark per il caso isAbsolute del percorso posix. Confronta i risultati e ispeziona l’implementazione corrispondente del modulo path per determinare se l’inlining di validator sia previsto oltre questo esempio; l’issue non indica alcun file sorgente di destinazione, test o criterio di completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Lets take the isAbsolute function of posix in the path module.
/**
* @param {string} path
* @returns {boolean}
*/
isAbsolute(path) {
validateString(path, 'path');
return path.length > 0 &&
StringPrototypeCharCodeAt(path, 0) === CHAR_FORWARD_SLASH;
},
Benchmark it:
./node benchmark/path/isAbsolute-posix.js
path/isAbsolute-posix.js n=100000 path="": 26,199,553.088023424
path/isAbsolute-posix.js n=100000 path=".": 19,512,560.625525866
path/isAbsolute-posix.js n=100000 path="/foo/bar": 15,003,530.33068681
path/isAbsolute-posix.js n=100000 path="/baz/..": 20,841,496.252698973
path/isAbsolute-posix.js n=100000 path="bar/baz": 25,044,717.342815597
inline validateString
/**
* @param {string} path
* @returns {boolean}
*/
isAbsolute(path) {
if (typeof path !== 'string')
throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
return path.length > 0 &&
StringPrototypeCharCodeAt(path, 0) === CHAR_FORWARD_SLASH;
},
./node benchmark/path/isAbsolute-posix.js
path/isAbsolute-posix.js n=100000 path="": 49,143,043.605605446
path/isAbsolute-posix.js n=100000 path=".": 36,665,695.025748484
path/isAbsolute-posix.js n=100000 path="/foo/bar": 20,950,367.322790273
path/isAbsolute-posix.js n=100000 path="/baz/..": 22,806,405.772027623
path/isAbsolute-posix.js n=100000 path="bar/baz": 41,722,470.470921524
Annoying...
- Lingua principale
- Shell
- Stelle
- 399
- Fork
- 11
- Merge medio
- 29m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/performance
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/performance#195 · 1 commento · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
nodejs/performance#194 · 5 commenti · 1 reazione ·
-
benchmark-needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
nodejs/performance#193 · 1 commento · 3 reazioni ·
-
Optimize TextEncoder::encode Apertamajor performance regression
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
nodejs/performance#192 · 33 commenti · 7 reazioni ·
-
good first issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
nodejs/performance#187 · 11 commenti ·
Tutte le issue di nodejs/performance
Issue simili
-
out-of-date
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
CachyOS/CachyOS-PKGBUILDS#1894 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
community-scripts/ProxmoxVE#17396 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mattpocock/skills#1099 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100