dgraph-io / ristretto

A high performance memory-bound Go cache

Home Page:https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add multidelete support.

poonai opened this issue · comments

Support multi delete.

Make Del as a vardic function to support delete.

commented

I would be happy to implement this if you need an extra pair of hands.

@momilo Feel free to take it.

@balajijinnah @momilo As I mentioned to @manishrjain there will be no performance gains in adding a MultiDelete function until we move from a sharded map implementation (if we do). Based on experiments at https://github.com/karlmcguire/stress we've found that the fastest overall solution is the one we're currently using: a sharded hashmap and calling Del on each shard.

Therefore, for MultiDelete the fastest solution is indeed the simplest most idiomatic one:

func (m *Map) MultiDel(keys []uint64) {
	for _, key := range keys {
		m.shards[key&shardMask].Del(key)
	}
}

This issue should be on hold until we change the underlying hashmap. For now, just call Del multiple times in a for loop.

Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing