mmapped file slightly faster
This commit is contained in:
parent
eb2ed15e33
commit
5bb2363eee
@ -36,14 +36,20 @@ end
|
||||
function main()
|
||||
open("../../../measurements.txt", "r") do f
|
||||
println("Start")
|
||||
sz = Base.stat(f).size
|
||||
data = mmap(f, Vector{UInt8}, sz)
|
||||
idxs = findall(isequal(0x0a), data)
|
||||
stations = Dict{String,StationMeasurements}()
|
||||
iteration = 0
|
||||
for line in eachline(f)
|
||||
last_idx = 1
|
||||
for i in eachindex(idxs)
|
||||
if iteration % 1000000 == 0 && iteration > 0
|
||||
print("\x1b[J\x1b[H")
|
||||
percent = round((iteration / 1000000000) * 100; digits=2)
|
||||
println("$(percent)%")
|
||||
end
|
||||
line = String(data[last_idx:idxs[i]-1])
|
||||
last_idx = idxs[i] + 1
|
||||
station, temp_str = rsplit(line, ";")
|
||||
temp = parse(Float32, temp_str)
|
||||
if haskey(stations, station)
|
||||
|
Loading…
Reference in New Issue
Block a user