What is faster: sparse vector or a dictionary?

const NLOOP = 1000000

yields

  157.137 ms (0 allocations: 0 bytes)
  157.251 ms (0 allocations: 0 bytes)
  36.294 ms (0 allocations: 0 bytes)
  37.151 ms (0 allocations: 0 bytes)
Main.m
1 Like