mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 17:43:24 +00:00
Add option "--timing" to mesure gitbook performances
This commit is contained in:
+22
-18
@@ -1,5 +1,6 @@
|
||||
var Immutable = require('immutable');
|
||||
|
||||
var timing = require('../utils/timing');
|
||||
var Page = require('../models/page');
|
||||
var walkSummary = require('./walkSummary');
|
||||
|
||||
@@ -14,27 +15,30 @@ function parsePagesList(book) {
|
||||
var summary = book.getSummary();
|
||||
var map = Immutable.OrderedMap();
|
||||
|
||||
return walkSummary(summary, function(article) {
|
||||
if (!article.isPage()) return;
|
||||
return timing.measure(
|
||||
'parse.listPages',
|
||||
walkSummary(summary, function(article) {
|
||||
if (!article.isPage()) return;
|
||||
|
||||
var filepath = article.getPath();
|
||||
var filepath = article.getPath();
|
||||
|
||||
// Is the page ignored?
|
||||
if (book.isContentFileIgnored(filepath)) return;
|
||||
// Is the page ignored?
|
||||
if (book.isContentFileIgnored(filepath)) return;
|
||||
|
||||
return fs.statFile(filepath)
|
||||
.then(function(file) {
|
||||
map = map.set(
|
||||
filepath,
|
||||
Page.createForFile(file)
|
||||
);
|
||||
}, function() {
|
||||
// file doesn't exist
|
||||
});
|
||||
})
|
||||
.then(function() {
|
||||
return map;
|
||||
});
|
||||
return fs.statFile(filepath)
|
||||
.then(function(file) {
|
||||
map = map.set(
|
||||
filepath,
|
||||
Page.createForFile(file)
|
||||
);
|
||||
}, function() {
|
||||
// file doesn't exist
|
||||
});
|
||||
})
|
||||
.then(function() {
|
||||
return map;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user