JSONBase.jl icon indicating copy to clipboard operation
JSONBase.jl copied to clipboard

Collaboration

Open Robert-j7 opened this issue 3 years ago • 3 comments

This is for continuing on the interaction we had. I'm more than happy to help. Please plan out what is left to do and we can discuss how I will do the tasks.

Robert-j7 avatar Oct 25 '22 15:10 Robert-j7

I also did a quick benchmark and JSON3 was 2.5 times faster and had way less allocations.

Robert-j7 avatar Oct 31 '22 05:10 Robert-j7

Thanks for opening this issue! And sorry for the slow response. Can you share the code that you benchmarked?

quinnj avatar Oct 31 '22 16:10 quinnj

I did a bigger test file and it is kinda night and day difference maybe I'm doing something wrong? I'm using JSONBase.read function from the package. Here is the code:

function JSBase()
       for i in eachindex(test)
       JSONBase.read(test[i])
       end
end

function JS3()
       for i in eachindex(test)
       JSON3.read(test[i])
       end
end

@benchmark JSBase()
BenchmarkTools.Trial: 1 sample with 1 evaluation.
 Single result which took 6.949 s (0.87% GC) to evaluate,
 with a memory estimate of 590.88 MiB, over 14346773 allocations.

@benchmark JS3()
BenchmarkTools.Trial: 22 samples with 1 evaluation.
 Range (min … max):  224.197 ms … 254.224 ms  ┊ GC (min … max): 21.74% … 23.47%
 Time  (median):     238.218 ms               ┊ GC (median):    22.18%
 Time  (mean ± σ):   237.677 ms ±   8.816 ms  ┊ GC (mean ± σ):  22.65% ±  1.76%

  █▁  ▁     ▁     ▁ ▁    █ ▁ ▁ ▁▁ ██▁               ▁   ▁  ▁  ▁  
  ██▁▁█▁▁▁▁▁█▁▁▁▁▁█▁█▁▁▁▁█▁█▁█▁██▁███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁█▁▁█▁▁█ ▁
  224 ms           Histogram: frequency by time          254 ms <

 Memory estimate: 242.61 MiB, allocs estimate: 430801.

Robert-j7 avatar Nov 04 '22 08:11 Robert-j7