The benchmark is done by running a linear search with total data: 1.000, 10.000, 100.000, and 1.000.000. The key is located at the end of the data.
System: MacBook Air Early 2015, Core i5-5250U 1.6 GHz Dual Core, 8 GB DDR3 RAM, macOS 10.14.5.
The result:
Total Data | Running Time (s) Dinfio 3.1.01 |
Running Time (s) Dinfio 3.1.0 |
---|---|---|
1k | 0.005 | 0.011 |
10k | 0.019 | 0.053 |
100k | 0.195 | 0.521 |
1M | 2.231 | 5.544 |
Code:
import fileio
data = []
key = "1000000"
found = false
' Read data from file
f = file("data-" & key & ".txt", file_read)
while !f.eof()
append(data, f.readln())
endwhile
' Search the key
for i, 0, size(data) - 1
if key == data[i]
found = true
break
endif
endfor
writeln(found)
Data: linear-search-data.zip.
The benchmark is done by running a loop of variable assignment 1.000.000, 10.000.000, and 100.000.000 times. Performance is compared to Dinfio 3.0.12.
System: Core i7-8565U 1.8 GHz Quad Core, 8 GB DDR4 RAM, Windows 10.
The result:
Loop Times | Running Time (s) Dinfio 3.1.0 |
Running Time (s) Dinfio 3.0.12 |
---|---|---|
1M | 0.031 | 0.82 |
10M | 0.28 | 4.16 |
100M | 2.67 | 28.82 |
Code 1:
n = 1000000
for i, 1, n
a = i
endfor
Code 2:
n = 10000000
for i, 1, n
a = i
endfor
Code 3:
n = 100000000
for i, 1, n
a = i
endfor