mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-30 08:19:54 +00:00
startup time speedup
This commit is contained in:
parent
627d7402ca
commit
46d8533fee
15
app/lru.js
Normal file
15
app/lru.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
var lru = require('lru-cache')({max: 256, maxAge: 250/*ms*/});
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
var origLstat = fs.realpathSync.bind(fs);
|
||||||
|
console.log('s')
|
||||||
|
// NB: The biggest offender of thrashing realpathSync is the node module system
|
||||||
|
// itself, which we can't get into via any sane means.
|
||||||
|
require('fs').realpathSync = function(p) {
|
||||||
|
let r = lru.get(p);
|
||||||
|
if (r) return r;
|
||||||
|
|
||||||
|
r = origLstat(p);
|
||||||
|
lru.set(p, r);
|
||||||
|
return r;
|
||||||
|
};
|
@ -1,3 +1,4 @@
|
|||||||
|
require('./lru.js')
|
||||||
if (process.platform == 'win32' && require('electron-squirrel-startup')) process.exit(0)
|
if (process.platform == 'win32' && require('electron-squirrel-startup')) process.exit(0)
|
||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import '../lru.js'
|
||||||
import 'source-sans-pro'
|
import 'source-sans-pro'
|
||||||
import 'font-awesome/css/font-awesome.css'
|
import 'font-awesome/css/font-awesome.css'
|
||||||
import 'ngx-toastr/toastr.css'
|
import 'ngx-toastr/toastr.css'
|
||||||
|
@ -64,6 +64,7 @@ module.exports = {
|
|||||||
'child_process': 'commonjs child_process',
|
'child_process': 'commonjs child_process',
|
||||||
'electron': 'commonjs electron',
|
'electron': 'commonjs electron',
|
||||||
'electron-is-dev': 'commonjs electron-is-dev',
|
'electron-is-dev': 'commonjs electron-is-dev',
|
||||||
|
'fs': 'commonjs fs',
|
||||||
'ngx-toastr': 'commonjs ngx-toastr',
|
'ngx-toastr': 'commonjs ngx-toastr',
|
||||||
'module': 'commonjs module',
|
'module': 'commonjs module',
|
||||||
'mz': 'commonjs mz',
|
'mz': 'commonjs mz',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user