thanks!!!

On Monday, March 9, 2015 at 6:38:05 PM UTC-7, Jacob Quinn wrote:
>
> http://docs.julialang.org/en/latest/stdlib/collections/#Base.sizehint!
>
> On Mon, Mar 9, 2015 at 7:34 PM, Dejan Miljkovic <[email protected] 
> <javascript:>> wrote:
>
>> I would like to initialize dictionary (String/String) with 4 million 
>> key/value pairs. Insert performance varies dramatically. Fast first 200k 
>> than slow around 300k. Pickups
>> at 400k and than slows down ...
>> This looks like memory allocation problem. I don't see the method where 
>> we can set size of the dictionary in advance.
>>
>> Dejan
>>
>> f = open(ARGS[1])
>> dic = Dict{String, String}()
>> cnt = 0
>> while !eof(f)
>>     cnt += 1
>>     if cnt%1000 == 0
>>         println(cnt)
>>     end
>>     line = chomp(readline(f))
>>     el = split(line, ",")
>>     key = el[1]
>>     val = el[2]
>>     dic[key] = val
>> end
>> close(f)
>>
>
>

Reply via email to