stingergraph / StingerGraphs.jl

Julialang bindings to the STINGER graph database
http://www.stingergraph.com
Other
5 stars 3 forks source link

Stinger Type Interface #3

Closed rohitvarkey closed 8 years ago

rohitvarkey commented 8 years ago

I couldn't use getfield or setfield! and override the a.b syntax due to https://github.com/JuliaLang/julia/issues/1974.

Using getindex and setindex! along with the defined enumerations allows for usage like

s = Stinger()
s[max_nv] = 1
s[max_nv] #Outputs 1

cc: @jpfairbanks

rohitvarkey commented 8 years ago

The benchmarks for the type stable getfield vs the type instable getfield are shown here:

julia> stableget = read(stable, "gettrial")
BenchmarkTools.Trial:
  samples:          10000000
  evals/sample:     1
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  0.00 bytes
  allocs estimate:  0
  minimum time:     38.00 ns (0.00% GC)
  median time:      41.00 ns (0.00% GC)
  mean time:        43.95 ns (0.00% GC)
  maximum time:     219.11 μs (0.00% GC)

julia> unstableget = read(unstable, "gettrial")
BenchmarkTools.Trial:
  samples:          10000000
  evals/sample:     1
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  32.00 bytes
  allocs estimate:  2
  minimum time:     366.00 ns (0.00% GC)
  median time:      398.00 ns (0.00% GC)
  mean time:        433.29 ns (1.10% GC)
  maximum time:     14.44 ms (99.79% GC)

I think this clearly shows that we should stick with the type stable version with the special functions for batch_time and update_time.

rohitvarkey commented 8 years ago

The insert remove benchmark here gives results of

Insert benchmark (attempting to insert 100000), terminates in 10 seconds.

BenchmarkTools.Trial:
  samples:          84062
  evals/sample:     182
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  16.00 bytes
  allocs estimate:  1
  minimum time:     582.00 ns (0.00% GC)
  median time:      586.00 ns (0.00% GC)
  mean time:        650.31 ns (0.12% GC)
  maximum time:     21.48 μs (0.00% GC)

Remove benchmark (25000)

BenchmarkTools.Trial:
  samples:          25000
  evals/sample:     178
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  16.00 bytes
  allocs estimate:  1
  minimum time:     599.00 ns (0.00% GC)
  median time:      604.00 ns (0.00% GC)
  mean time:        658.24 ns (0.14% GC)
  maximum time:     10.11 μs (91.55% GC)
rohitvarkey commented 8 years ago

The outdegree and successors implementation depends on https://github.com/stingergraph/stinger/pull/204 being merged.