bench-hexo 0.1.0-beta.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +141 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,141 @@
1
- # bench-hexo
1
+ # bench-hexo
2
+
3
+ A benchmarking cli for Hexo, modified from [hexo#benchmark.js](https://github.com/hexojs/hexo/blob/master/test/benchmark.js)
4
+
5
+ ## Usage
6
+
7
+ ### Profiling
8
+
9
+ Use [0x](https://github.com/davidmarkclements/0x) to generate a flamegraph for the Hexo generation process.
10
+
11
+ #### Syntax
12
+
13
+ ```bash
14
+ npx bench-hexo profiling [options]
15
+ ```
16
+
17
+ #### Options
18
+
19
+ - `--no-clean`: Do not clean Hexo cache before profiling.
20
+
21
+ #### Example
22
+
23
+ ```plain
24
+ ✔ Cleaning complete.
25
+ ✔ Profiling complete. Flamegraph saved to 0x directory.
26
+ ```
27
+
28
+ ### Benchmark
29
+
30
+ Use perf_hooks to measure the performance metrics of the Hexo generation process.
31
+
32
+ #### Syntax
33
+
34
+ ```bash
35
+ npx bench-hexo benchmark
36
+ ```
37
+
38
+ #### Example
39
+
40
+ ```plain
41
+ ✔ Cleaning complete.
42
+ Cold processing
43
+ ┌──────────────────────────────┬───────────────┐
44
+ │ (index) │ Cost time (s) │
45
+ ├──────────────────────────────┼───────────────┤
46
+ │ Load Plugin/Scripts/Database │ '0.20s' │
47
+ │ Process Source │ '1.57s' │
48
+ │ Render Posts │ '1.31s' │
49
+ │ Render Files │ '2.17s' │
50
+ │ Save Database │ '0.15s' │
51
+ │ Total time │ '5.39s' │
52
+ └──────────────────────────────┴───────────────┘
53
+ Hot processing
54
+ ┌──────────────────────────────┬───────────────┐
55
+ │ (index) │ Cost time (s) │
56
+ ├──────────────────────────────┼───────────────┤
57
+ │ Load Plugin/Scripts/Database │ '0.48s' │
58
+ │ Process Source │ '0.48s' │
59
+ │ Render Files │ '1.77s' │
60
+ │ Save Database │ '0.15s' │
61
+ │ Total time │ '2.89s' │
62
+ └──────────────────────────────┴───────────────┘
63
+ ✔ Cleaning complete.
64
+ Another Cold processing
65
+ ┌──────────────────────────────┬───────────────┐
66
+ │ (index) │ Cost time (s) │
67
+ ├──────────────────────────────┼───────────────┤
68
+ │ Load Plugin/Scripts/Database │ '0.20s' │
69
+ │ Process Source │ '1.61s' │
70
+ │ Render Posts │ '1.33s' │
71
+ │ Render Files │ '2.19s' │
72
+ │ Save Database │ '0.15s' │
73
+ │ Total time │ '5.49s' │
74
+ └──────────────────────────────┴───────────────┘
75
+ ```
76
+
77
+
78
+ ### Memory
79
+
80
+ Use [megumu](https://github.com/D-Sketon/megumu) to measure the memory usage of the Hexo generation process.
81
+
82
+ #### Syntax
83
+
84
+ ```bash
85
+ node src/index.js memory [options]
86
+ ```
87
+
88
+ #### Options
89
+
90
+ - `-s, --sample-rate <number>`: Sample rate in milliseconds (default: 500ms).
91
+ - `--no-clean`: Do not clean Hexo cache before profiling.
92
+
93
+ #### Example
94
+
95
+ ```plain
96
+ ✔ Cleaning complete.
97
+ ✔ Memory profiling complete.
98
+ 437.21┤ ╭╮
99
+ 427.65┤ ││
100
+ 418.09┤ ││
101
+ 408.52┤ ││
102
+ 398.96┤ ││
103
+ 389.40┤ ││
104
+ 379.83┤ ││
105
+ 370.27┤ ╭╯│
106
+ 360.71┤ │ ╰
107
+ 351.14┤ │
108
+ 341.58┤ │
109
+ 332.01┤ ╭╯
110
+ 322.45┤ │
111
+ 312.89┤ │
112
+ 303.32┤ │
113
+ 293.76┤ │
114
+ 284.20┤ │
115
+ 274.63┤ ╭╯
116
+ 265.07┤ │
117
+ 255.51┤ │
118
+ 245.94┤ │
119
+ 236.38┤ ╭╯
120
+ 226.81┤ │
121
+ 217.25┤ ╭╯
122
+ 207.69┤ │
123
+ 198.12┤ │
124
+ 188.56┤ │
125
+ 179.00┤ │
126
+ 169.43┤ │
127
+ 159.87┤╭╯
128
+ 150.30┼╯
129
+
130
+
131
+ RSS Memory Stats:
132
+
133
+ Avg: 284.11MB
134
+ Min: 150.30MB
135
+ Max: 437.21MB
136
+ Midian: 277.64MB
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bench-hexo",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0",
4
4
  "bin": {
5
5
  "bench-hexo": "dist/index.js"
6
6
  },