-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecated
elsif
, new "chaining" syntax
- Loading branch information
Showing
15 changed files
with
146 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!../bin/zrc | ||
set i = 0 | ||
read -p "What to do? (0, 1, 2 or something else) " x | ||
|
||
if {$x == 0} { | ||
ls | wc -mlw | ||
cd ~/ | ||
} else { | ||
if {$x == 1} { | ||
echo 'You entered 1!' | ||
} else if {$x == 2} { | ||
echo 'You entered 2!' | ||
} else while {$i < 10} { | ||
echo $i | ||
inc i | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Bash will always be faster: | ||
0.08user 0.08system 0:00.16elapsed 98%CPU (0avgtext+0avgdata 6788maxresident)k | ||
0inputs+0outputs (0major+1106minor)pagefaults 0swaps | ||
|
||
Fish is also fast, but uses more memory: | ||
0.12user 0.07system 0:00.20elapsed 98%CPU (0avgtext+0avgdata 17200maxresident)k | ||
0inputs+0outputs (0major+2663minor)pagefaults 0swaps | ||
|
||
Csh will use more CPU power: | ||
0.86user 1.10system 0:01.96elapsed 100%CPU (0avgtext+0avgdata 4036maxresident)k | ||
0inputs+0outputs (3major+333953minor)pagefaults 0swaps | ||
|
||
Zrc will also have lower memory consumption: | ||
6.70user 22.51system 0:29.60elapsed 98%CPU (0avgtext+0avgdata 4508maxresident)k | ||
0inputs+0outputs (9major+1381354minor)pagefaults 0swaps | ||
|
||
Rc is comparable to Zrc in terms of performance: | ||
8.60user 18.88system 0:27.75elapsed 99%CPU (0avgtext+0avgdata 2980maxresident)k | ||
0inputs+0outputs (0major+3829864minor)pagefaults 0swaps | ||
|
||
Powershell performs the worst: | ||
29.91user 46.83system 1:10.31elapsed 109%CPU (0avgtext+0avgdata 124964maxresident)k | ||
0inputs+296outputs (0major+745159minor)pagefaults 0swaps | ||
|
||
CONCLUSION: Zrc doesn't totally suck ;) It's just very lightweight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/lib/zrc/bin/zrc | ||
set env(tf) = `{mktemp} | ||
set outfile = "speedtest.out" | ||
|
||
rm -f $outfile && unbuffer -p zrc -c { | ||
fn main { | ||
echo "\nBash will always be faster:" | ||
time bash -c { | ||
for i in {1..10000}; do | ||
# Print out to the file | ||
printf '%d ' $i >> $tf | ||
done | ||
rm $tf | ||
} | ||
|
||
echo "\nFish is also fast, but uses more memory:" | ||
time fish -c { | ||
for i in (seq 0 10000) | ||
printf '%d ' $i >> $tf | ||
end | ||
rm $tf | ||
} | ||
|
||
echo "\nCsh will use more CPU power:" | ||
time csh <<< { | ||
@ i = 0 | ||
while ($i <= 10000) | ||
# Just a comment... test | ||
printf '%d ' $i >> $tf | ||
@ i += 5 | ||
end | ||
rm $tf | ||
} | ||
|
||
echo "\nZrc will also have lower memory consumption:" | ||
time zrc -c { | ||
for {set i = 0} {$i <= 10000} {inc i} { | ||
# This is a comment | ||
printf '%d ' $i >> $env(tf) | ||
} | ||
rm $env(tf) | ||
} | ||
|
||
echo "\nRc is comparable to Zrc in terms of performance:" | ||
time rc -c { | ||
for (i in `{seq 0 10000}) { | ||
# Rc has an AST, so comments don't affect performance | ||
printf '%d ' $i >> $tf | ||
} | ||
rm $tf | ||
} | ||
|
||
echo "\nPowershell performs the worst:" | ||
time >(1=) pwsh -c { | ||
for ($i = 0; $i -lt 10000; ++$i) { | ||
# Comment test | ||
printf '%d ' $i >> $env:tf | ||
} | ||
rm $env:tf | ||
} | ||
|
||
echo "\nCONCLUSION: Zrc doesn't totally suck ;) It's just very lightweight" | ||
}; main >(2=1) | ||
} | tee $outfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters