Tolga Erdogus - 247 - Aug 3, 2014

I am new to Redis and having a really hard time with performance - I described the issue over here:

Would you be kind enough to see whether you can pinpoint what I may be doing wrong?


Hi Tolga, just checked this and your right, it should be moved to the outerloop which I’ve done in this commit:
Cutting a new build for you now, will let you know when its ready.

Ok this has just been deployed to MyGet, you can get it at:
let me know how it goes, thx.

Tolga Erdogus:

Demis - thanks for getting back to quickly.  I don’t really understand what the code is doing so I am going to comment abstractly.

entry.Value and registeredTypeIdsWithinPipeline both contain the same x ids.  So the inner foreach and its inner Each(x=>…) together still (after you mod) execute x*x times.

Again - I have no idea what I am doing but it’s almost like it needs to be like this:

  internal void AddTypeIdsRegisteredDuringPipeline()
            foreach (var entry in registeredTypeIdsWithinPipelineMap)
                var typeIdsSetKey = entry.Key;
                var registeredTypeIdsWithinPipeline = GetRegisteredTypeIdsWithinPipeline(typeIdsSetKey);

                foreach (var id in entry.Value)
                    //registeredTypeIdsWithinPipeline.Each(x => this.AddItemToSet(typeIdsSetKey, id));
                    this.AddItemToSet(typeIdsSetKey, id);
            registeredTypeIdsWithinPipelineMap = new Dictionary<string, HashSet<string>>();

Yep like you say it’s still iterating over the collection twice. In which case this can be much better optimized to run within a pipeline. Now updated in this commit:

Which is now available on MyGet.
As it keeps the same version number, if you installed from MyGet earlier you’ll have to uninstall so NuGet will pull the latest packages.

Tolga Erdogus:

This seems to fix my problem.  Thanks very much!