rush-sh 0.8.0

A POSIX sh-compatible shell written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Performance Benchmarks - Rush Shell Documentation</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link
        href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap"
        rel="stylesheet">
</head>

<body>
    <div class="layout">
        <!-- Sidebar Navigation -->
        <nav class="sidebar" id="sidebar">
            <div class="sidebar-header">
                <div class="logo-container">
                    <div class="logo">🚀</div>
                    <h2>Rush Shell</h2>
                </div>
            </div>

            <div class="sidebar-nav">
                <a href="index.html" class="nav-link">
                    <span class="nav-icon">🏠</span>
                    <span>Overview</span>
                </a>
                <a href="features.html" class="nav-link">
                    <span class="nav-icon"></span>
                    <span>Features</span>
                </a>
                <a href="installation.html" class="nav-link">
                    <span class="nav-icon">📦</span>
                    <span>Installation</span>
                </a>
                <a href="usage.html" class="nav-link">
                    <span class="nav-icon">🎯</span>
                    <span>Usage</span>
                </a>
                <a href="architecture.html" class="nav-link">
                    <span class="nav-icon">🏗️</span>
                    <span>Architecture</span>
                </a>
                <a href="compliance.html" class="nav-link">
                    <span class="nav-icon"></span>
                    <span>POSIX Compliance</span>
                </a>
                <a href="benchmarks.html" class="nav-link active">
                    <span class="nav-icon">📊</span>
                    <span>Benchmarks</span>
                </a>
            </div>

            <div class="sidebar-footer">
                <div class="version-info">
                    <span class="version">v0.8.0</span>
                    <span class="status">~96% POSIX Compliant</span>
                </div>
                <div class="external-links">
                    <a href="https://github.com/drewwalton19216801/rush-sh" target="_blank" class="external-link">
                        <span class="nav-icon">🔗</span>
                        <span>GitHub</span>
                    </a>
                </div>
            </div>
        </nav>

        <!-- Main Content -->
        <main class="main-content">
            <!-- Mobile menu button -->
            <button class="mobile-menu-btn" id="mobileMenuBtn">
                <span></span>
                <span></span>
                <span></span>
            </button>

            <!-- Header -->
            <header class="page-header">
                <div class="header-content">
                    <div class="breadcrumb">
                        <a href="index.html">Rush Shell Documentation</a><span>Benchmarks</span>
                    </div>
                    <div class="header-actions">
                        <button class="theme-toggle" id="themeToggle">
                            <span class="theme-icon">🌙</span>
                        </button>
                        <div class="search-container">
                            <input type="text" class="search-input" placeholder="Search documentation..."
                                id="searchInput">
                            <span class="search-icon">🔍</span>
                        </div>
                    </div>
                </div>
            </header>

            <!-- Page Content -->
            <div class="page-content">
                <div class="benchmarks-hero">
                    <h1>📊 Performance Benchmarks</h1>
                    <p>Comprehensive performance analysis of Rush Shell components and operations</p>

                    <!-- Quick Stats -->
                    <div class="benchmark-stats">
                        <div class="stat-card">
                            <div class="stat-icon"></div>
                            <div class="stat-content">
                                <div class="stat-value">20</div>
                                <div class="stat-label">Benchmark Categories</div>
                            </div>
                        </div>
                        <div class="stat-card">
                            <div class="stat-icon">⏱️</div>
                            <div class="stat-content">
                                <div class="stat-value">4.20s</div>
                                <div class="stat-label">Total Execution Time</div>
                            </div>
                        </div>
                        <div class="stat-card">
                            <div class="stat-icon">📈</div>
                            <div class="stat-content">
                                <div class="stat-value">210ms</div>
                                <div class="stat-label">Average per Benchmark</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Benchmark Report -->
                <section id="benchmark-report">
                    <h2>📋 Latest Benchmark Report</h2>

                    <div class="report-container">
                        <div class="report-header">
                            <div class="report-info">
                                <h3>🚀 Rush Shell Performance Benchmark Report</h3>
                            </div>
                            <div class="report-actions">
                                <a href="benchmark_report.html" target="_blank" class="report-button primary">
                                    <span>🔗</span>
                                    <span>View Full Report</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Performance Analysis -->
                <section id="performance-analysis">
                    <h2>📈 Performance Analysis</h2>

                    <div class="analysis-grid">
                        <div class="analysis-card">
                            <h3>Performance Distribution</h3>
                            <div class="performance-breakdown">
                                <div class="perf-item fast">
                                    <span class="perf-label">Fast (<10ms)< /span>
                                            <span class="perf-count">5 benchmarks</span>
                                </div>
                                <div class="perf-item medium">
                                    <span class="perf-label">Medium (10-100ms)</span>
                                    <span class="perf-count">2 benchmarks</span>
                                </div>
                                <div class="perf-item slow">
                                    <span class="perf-label">Slow (≥100ms)</span>
                                    <span class="perf-count">13 benchmarks</span>
                                </div>
                            </div>
                        </div>

                        <div class="analysis-card">
                            <h3>Fastest Components</h3>
                            <div class="fastest-list">
                                <div class="component-item">
                                    <span class="component-name">Lexer (Basic Tokens)</span>
                                    <span class="component-time">379,929 ops/sec</span>
                                </div>
                                <div class="component-item">
                                    <span class="component-name">Parser (Basic Commands)</span>
                                    <span class="component-time">100,020 ops/sec</span>
                                </div>
                                <div class="component-item">
                                    <span class="component-name">Case Statements</span>
                                    <span class="component-time">1,787 ops/sec</span>
                                </div>
                            </div>
                        </div>

                        <div class="analysis-card">
                            <h3>Optimization Opportunities</h3>
                            <div class="slowest-list">
                                <div class="component-item slow">
                                    <span class="component-name">External Commands</span>
                                    <span class="component-time">155 ops/sec</span>
                                </div>
                                <div class="component-item slow">
                                    <span class="component-name">Complex Pipelines</span>
                                    <span class="component-time">168 ops/sec</span>
                                </div>
                                <div class="component-item slow">
                                    <span class="component-name">Script Execution</span>
                                    <span class="component-time">231 ops/sec</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Benchmark Categories -->
                <section id="benchmark-categories">
                    <h2>🧪 Benchmark Categories</h2>

                    <div class="categories-grid">
                        <div class="category-card">
                            <div class="category-icon">📝</div>
                            <h3>Lexer Benchmarks</h3>
                            <p>Tokenization performance for various command types</p>
                            <ul>
                                <li>Basic tokenization (simple commands)</li>
                                <li>Complex tokenization (quotes, variables, expansions)</li>
                                <li>Large input tokenization</li>
                            </ul>
                        </div>

                        <div class="category-card">
                            <div class="category-icon">🔍</div>
                            <h3>Parser Benchmarks</h3>
                            <p>AST construction speed for complex structures</p>
                            <ul>
                                <li>Basic command parsing</li>
                                <li>Complex structure parsing (if/for/while/case)</li>
                                <li>Function definition parsing</li>
                            </ul>
                        </div>

                        <div class="category-card">
                            <div class="category-icon"></div>
                            <h3>Executor Benchmarks</h3>
                            <p>Command execution performance</p>
                            <ul>
                                <li>Built-in command execution</li>
                                <li>External command execution</li>
                                <li>Variable operations</li>
                            </ul>
                        </div>

                        <div class="category-card">
                            <div class="category-icon">🔄</div>
                            <h3>Expansion Benchmarks</h3>
                            <p>Variable and arithmetic expansion speed</p>
                            <ul>
                                <li>Variable expansion performance</li>
                                <li>Arithmetic expansion performance</li>
                                <li>Command substitution performance</li>
                            </ul>
                        </div>

                        <div class="category-card">
                            <div class="category-icon">🏗️</div>
                            <h3>Control Structure Benchmarks</h3>
                            <p>If/for/while/case statement performance</p>
                            <ul>
                                <li>If statement execution</li>
                                <li>Loop execution (for/while)</li>
                                <li>Case statement execution</li>
                            </ul>
                        </div>

                        <div class="category-card">
                            <div class="category-icon">🔗</div>
                            <h3>Pipeline Benchmarks</h3>
                            <p>Pipe and redirection performance</p>
                            <ul>
                                <li>Simple pipeline execution</li>
                                <li>Complex pipeline execution</li>
                                <li>Pipeline with redirections</li>
                            </ul>
                        </div>
                    </div>
                </section>

                <!-- Running Benchmarks -->
                <section id="running-benchmarks">
                    <h2>🎯 Running Benchmarks</h2>

                    <div class="benchmark-instructions">
                        <div class="instruction-card">
                            <h3>Complete Benchmark Suite</h3>
                            <div class="code-block">
                                <pre><code># Run from benchmarks directory
cd benchmarks
mkdir -p target
cargo run --bin rush-benchmark

# Copy report to docs
cp target/benchmark_report.html ../docs/benchmark_report.html</code></pre>
                            </div>
                            <p>Executes 20+ benchmark scenarios covering all major components</p>
                        </div>

                        <div class="instruction-card">
                            <h3>View HTML Report</h3>
                            <div class="code-block">
                                <pre><code># Serve locally from benchmarks directory
cd benchmarks
python3 -m http.server 8000 -d target/

# Visit http://localhost:8000/benchmark_report.html</code></pre>
                            </div>
                            <p>Visual report with detailed metrics and performance analysis</p>
                        </div>

                        <div class="instruction-card">
                            <h3>JSON Results</h3>
                            <div class="code-block">
                                <pre><code># Machine-readable results from benchmarks directory
cat benchmarks/target/benchmark_results.json</code></pre>
                            </div>
                            <p>Structured data for CI/CD integration and trend analysis</p>
                        </div>
                    </div>
                </section>

                <!-- Performance Monitoring -->
                <section id="monitoring">
                    <h2>📊 Performance Monitoring</h2>

                    <div class="monitoring-features">
                        <div class="monitor-card">
                            <div class="monitor-icon">🔍</div>
                            <h3>Regression Detection</h3>
                            <p>Track performance changes over time and identify regressions during development</p>
                        </div>

                        <div class="monitor-card">
                            <div class="monitor-icon"></div>
                            <h3>Optimization Validation</h3>
                            <p>Verify performance improvements and ensure no regressions in execution speed</p>
                        </div>

                        <div class="monitor-card">
                            <div class="monitor-icon">🔄</div>
                            <h3>CI/CD Integration</h3>
                            <p>Automated performance testing in build pipelines for continuous monitoring</p>
                        </div>

                        <div class="monitor-card">
                            <div class="monitor-icon">📈</div>
                            <h3>Historical Tracking</h3>
                            <p>JSON export enables trend analysis and long-term performance monitoring</p>
                        </div>
                    </div>
                </section>

                <!-- Recommendations -->
                <section id="recommendations">
                    <h2>💡 Recommendations</h2>

                    <div class="recommendations">
                        <div class="recommendation-card warning">
                            <div class="rec-icon">⚠️</div>
                            <div class="rec-content">
                                <h3>Performance Optimization</h3>
                                <p>Some benchmarks are running slowly. Consider optimizing the slowest components
                                    identified in the benchmark report.</p>
                            </div>
                        </div>

                        <div class="recommendation-card info">
                            <div class="rec-icon">💡</div>
                            <div class="rec-content">
                                <h3>Regular Monitoring</h3>
                                <p>Run benchmarks regularly to track performance trends over time and catch regressions
                                    early.</p>
                            </div>
                        </div>

                        <div class="recommendation-card info">
                            <div class="rec-icon">🔍</div>
                            <div class="rec-content">
                                <h3>Focus Areas</h3>
                                <p>Focus optimization efforts on the slowest benchmarks identified in the detailed
                                    results above.</p>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Navigation Footer -->
                <div class="section-nav">
                    <div class="nav-links">
                        <a href="compliance.html" class="nav-button secondary">
                            <span>← POSIX Compliance</span>
                        </a>
                        <a href="index.html" class="nav-button primary">
                            <span>Back to Overview</span>
                            <span class="nav-arrow"></span>
                        </a>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script src="script.js"></script>
</body>

</html>