8000 Test all versions of shelljs · shelljs/benchmarks@9070692 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9070692

Browse files
freitagbrnfischer
authored andcommitted
Test all versions of shelljs
1 parent 141ff7d commit 9070692

File tree

2 files changed

+112
-37
lines changed

2 files changed

+112
-37
lines changed

README.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -48,96 +48,96 @@ There is NO WARRANTY, to the extent permitted by law.
4848

4949
### [echoIntoFile](test/echoIntoFile)
5050

51-
- [Bash](test/echoIntoFile/echoIntoFile.sh) took `842` milliseconds
51+
- [Bash](test/echoIntoFile/echoIntoFile.sh) took `836` milliseconds
5252

5353
- [ShellJS 0.5.3](test/echoIntoFile/echoIntoFile.js) took `251` milliseconds
5454

55-
- [ShellJS 0.6.0](test/echoIntoFile/echoIntoFile.js) took `260` milliseconds
55+
- [ShellJS 0.6.0](test/echoIntoFile/echoIntoFile.js) took `306` milliseconds
5656

57-
- [ShellJS latest](test/echoIntoFile/echoIntoFile.js) took `199` milliseconds
57+
- [ShellJS latest](test/echoIntoFile/echoIntoFile.js) took `187` milliseconds
5858

59-
ShellJS was `4.231` times faster than Bash
59+
ShellJS was `4.471` times faster than Bash
6060

6161
### [envVariable](test/envVariable)
6262

63-
- [Bash](test/envVariable/envVar.sh) took `333` milliseconds
63+
- [Bash](test/envVariable/envVar.sh) took `220` milliseconds
6464

6565
- [ShellJS 0.5.3](test/envVariable/envVar.js) took `288` milliseconds
6666

67-
- [ShellJS 0.6.0](test/envVariable/envVar.js) took `291` milliseconds
67+
- [ShellJS 0.6.0](test/envVariable/envVar.js) took `302` milliseconds
6868

69-
- [ShellJS latest](test/envVariable/envVar.js) took `687` milliseconds
69+
- [ShellJS latest](test/envVariable/envVar.js) took `566` milliseconds
7070

71-
Bash was `2.063` times faster than ShellJS
71+
Bash was `2.573` times faster than ShellJS
7272

7373
### [forLoopAlternateSyntax](test/forLoopAlternateSyntax)
7474

75-
- [Bash](test/forLoopAlternateSyntax/helloworld10k.sh) took `100` milliseconds
75+
- [Bash](test/forLoopAlternateSyntax/helloworld10k.sh) took `89` milliseconds
7676

77-
- [ShellJS 0.5.3](test/forLoopAlternateSyntax/helloworld10k.js) took `182` milliseconds
77+
- [ShellJS 0.5.3](test/forLoopAlternateSyntax/helloworld10k.js) took `190` milliseconds
7878

79-
- [ShellJS 0.6.0](test/forLoopAlternateSyntax/helloworld10k.js) took `178` milliseconds
79+
- [ShellJS 0.6.0](test/forLoopAlternateSyntax/helloworld10k.js) took `179` milliseconds
8080

81-
- [ShellJS latest](test/forLoopAlternateSyntax/helloworld10k.js) took `221` milliseconds
81+
- [ShellJS latest](test/forLoopAlternateSyntax/helloworld10k.js) took `224` milliseconds
8282

83-
Bash was `2.210` times faster than ShellJS
83+
Bash was `2.517` times faster than ShellJS
8484

8585
### [helloworld](test/helloworld)
8686

87-
- [Bash](test/helloworld/helloworld.sh) took `84` milliseconds
87+
- [Bash](test/helloworld/helloworld.sh) took `85` milliseconds
8888

89-
- [ShellJS 0.5.3](test/helloworld/helloworld.js) took `161` milliseconds
89+
- [ShellJS 0.5.3](test/helloworld/helloworld.js) took `171` milliseconds
9090

91-
- [ShellJS 0.6.0](test/helloworld/helloworld.js) took `170` milliseconds
91+
- [ShellJS 0.6.0](test/helloworld/helloworld.js) took `172` milliseconds
9292

93-
- [ShellJS latest](test/helloworld/helloworld.js) took `196` milliseconds
93+
- [ShellJS latest](test/helloworld/helloworld.js) took `179` milliseconds
9494

95-
Bash was `2.333` times faster than ShellJS
95+
Bash was `2.106` times faster than ShellJS
9696

9797
### [helloworld10k](test/helloworld10k)
9898

99-
- [Bash](test/helloworld10k/helloworld10k.sh) took `198` milliseconds
99+
- [Bash](test/helloworld10k/helloworld10k.sh) took `162` milliseconds
100100

101-
- [ShellJS 0.5.3](test/helloworld10k/helloworld10k.js) took `300` milliseconds
101+
- [ShellJS 0.5.3](test/helloworld10k/helloworld10k.js) took `256` milliseconds
102102

103-
- [ShellJS 0.6.0](test/helloworld10k/helloworld10k.js) took `261` milliseconds
103+
- [ShellJS 0.6.0](test/helloworld10k/helloworld10k.js) took `296` milliseconds
104104

105-
- [ShellJS latest](test/helloworld10k/helloworld10k.js) took `537` milliseconds
105+
- [ShellJS latest](test/helloworld10k/helloworld10k.js) took `598` milliseconds
106106

107-
Bash was `2.712` times faster than ShellJS
107+
Bash was `3.691` times faster than ShellJS
108108

109109
### [ls10k](test/ls10k)
110110

111-
- [Bash](test/ls10k/ls10k.sh) took `13272` milliseconds
111+
- [Bash](test/ls10k/ls10k.sh) took `11441` milliseconds
112112

113-
- [ShellJS 0.5.3](test/ls10k/ls10k.js) took `1145` milliseconds
113+
- [ShellJS 0.5.3](test/ls10k/ls10k.js) took `796` milliseconds
114114

115-
- [ShellJS 0.6.0](test/ls10k/ls10k.js) took `1313` milliseconds
115+
- [ShellJS 0.6.0](test/ls10k/ls10k.js) took `785` milliseconds
116116

117-
- [ShellJS latest](test/ls10k/ls10k.js) took `2348` milliseconds
117+
- [ShellJS latest](test/ls10k/ls10k.js) took `1091` milliseconds
118118

119-
ShellJS was `5.652` times faster than Bash
119+
ShellJS was `10.487` times faster than Bash
120120

121121
### [pwd10k](test/pwd10k)
122122

123-
- [Bash](test/pwd10k/path10k.sh) took `1259` milliseconds
123+
- [Bash](test/pwd10k/path10k.sh) took `882` milliseconds
124124

125-
- [ShellJS 0.5.3](test/pwd10k/path10k.js) took `1696` milliseconds
125+
- [ShellJS 0.5.3](test/pwd10k/path10k.js) took `1902` milliseconds
126126

127-
- [ShellJS 0.6.0](test/pwd10k/path10k.js) took `2314` milliseconds
127+
- [ShellJS 0.6.0](test/pwd10k/path10k.js) took `2128` milliseconds
128128

129-
- [ShellJS latest](test/pwd10k/path10k.js) took `6881` milliseconds
129+
- [ShellJS latest](test/pwd10k/path10k.js) took `6090` milliseconds
130130

131-
Bash was `5.465` times faster than ShellJS
131+
Bash was `6.905` times faster than ShellJS
132132

133133
### [touchSyntax0.6](test/touchSyntax0.6)
134134

135-
- [Bash](test/touchSyntax0.6/touchrm10k.sh) took `1750` milliseconds
135+
- [Bash](test/touchSyntax0.6/touchrm10k.sh) took `1423` milliseconds
136136

137137
- Skipping test for ShellJS 0.5.3
138138

139-
- [ShellJS 0.6.0](test/touchSyntax0.6/touchrm10k.js) took `275` milliseconds
139+
- [ShellJS 0.6.0](test/touchSyntax0.6/touchrm10k.js) took `274` milliseconds
140140

141-
- [ShellJS latest](test/touchSyntax0.6/touchrm10k.js) took `523` milliseconds
141+
- [ShellJS latest](test/touchSyntax0.6/touchrm10k.js) took `487` milliseconds
142142

143-
ShellJS was `3.346` times faster than Bash
143+
ShellJS was `2.922` times faster than Bash

benchmark.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,78 @@ if (shouldLog) {
147147
// Append new docs to README
148148
sed('-i', /## Results/, '## Results\n\n' + text, 'README.md');
149149
}
150+
// =======
151+
// require('fs').readdirSync('shelljs').forEach(function (version) {
152+
// console.log('Testing ShellJS version ' + version);
153+
// require('./shelljs/' + version);
154+
// cd(__dirname + '/' + TEST_DIR);
155+
// var prefix;
156+
// var shellJSWins = [];
157+
// ls().forEach(function (dir) {
158+
// prefix = TEST_DIR + '/' + dir;
159+
// writeLog('### [' + dir + ']', prefix)
160+
// cd(dir)
161+
162+
// // Find the files
163+
// var jsfile = ls('*.js')[0];
164+
// var shfile = ls('*.sh')[0];
165+
166+
// if (!jsfile || !shfile) {
167+
// console.error('Could not find your files. Please use proper extensions.');
168+
// return;
169+
// }
170+
171+
// // execute it
172+
// var start_time,
173+
// end_time,
174+
// shell_time,
175+
// shell_output,
176+
// js_time,
177+
// js_output;
178+
179+
// config.silent = true;
180+
181+
// start_time = new Date().getTime();
182+
// js_output = exec('node ' + jsfile).output;
183+
// end_time = new Date().getTime();
184+
// js_time = end_time - start_time;
185+
// writeLog(' - [ShellJS] took `' + js_time + '` milliseconds', prefix + '/' + jsfile);
186+
187+
// start_time = new Date().getTime();
188+
// shell_output = exec('bash ' + shfile).output;
189+
// end_time = new Date().getTime();
190+
// shell_time = end_time - start_time;
191+
// writeLog(' - [Bash] took `' + shell_time + '` milliseconds', prefix + '/' + shfile);
192+
193+
// if (shell_time < js_time) {
194+
// writeLog('Bash was `' + (js_time/shell_time).toFixed(3) + '` times faster than ShellJS');
195+
// } else {
196+
// writeLog('ShellJS was `' + (shell_time/js_time).toFixed(3) + '` times faster than Bash');
197+
// shellJSWins.push(dir);
198+
// }
199+
200+
// if (shell_output !== js_output)
201+
// writeLog('Output differs');
202+
203+
// // Clean up
204+
// echo('=======================');
205+
// echo();
206+
// config.silent = false;
207+
// cd('..')
208+
// });
209+
210+
// if (shouldLog) {
211+
// cd(__dirname);
212+
// var text = '### ShellJS performance wins\n\n';
213+
// text += shellJSWins.map(x => ' - [' + x + '](' + TEST_DIR + '/' + x + ')').join('\n');
214+
// text += '\n\n' + log.join('\n\n');
215+
216+
// // Wipe out the old results
217+
// cat('README.md').replace(/## Results(.|\n)*/, '## Results').to('README.md');
218+
219+
// // Append new docs to README
220+
// sed('-i', /## Results/, '## Results\n\n' + text, 'README.md');
221+
// }
222+
// >>>>>>> Test all versions of shelljs
223+
// cd(__dirname);
224+
// });

0 commit comments

Comments
 (0)
0