Echo/Print 90000 sort, minden sorban az aktuális sorszámot, while és for ciklussal egyaránt.
Időeredmények:
Shell Script:
4.497 sec - for
248.98 sec - while
Python:
0.962 sec - for
1.098 sec - while
Scriptek:
Shell - for
#!/bin/bash
for i in {1..90000}
do
echo "$i"
done
Shell - while
#!/bin/sh
a=0
while [ $a -lt 9000 ]
do
echo $a
a=`expr $a + 1`
done
Python - for
#!/usr/bin/python
for i in range(1,90000):
print i
Python - while
#!/usr/bin/python
count = 0
while (count < 90000):
print count
count = count + 1
--
A teszt Raspberry Pi3 alatt futott, Raspbian 8.7-es rendszerrel.