Hello,

I’m using the sorted set in a vst to store MIDI events every 16th note. The order is not important, just that the CC# and CC_Value happened. I want to be able to store values for two different controllers in a single sorted set (MIDI Channel 1, and MIDI Channel 2). To do this I vectorized the incoming MIDI using code similar to the following:

```
if (message.getChannel() == channelA)
{
//vectorize the input
performerSortedSet.add (message.getControllerValue() + (message.getControllerNumber() * 128));
}
else if (message.getChannel() == channelB)
{
//vectorize the input
performerSortedSet.add (message.getControllerValue() + ((message.getControllerNumber() + 128) * 128));
}
```

The only catch is that I seem to be taking a really big hit for finding the intersection of 2 sets once I add values in ChannelB (10% increase on my macbook). My guess is that its because the numbers are bigger… but a sortedset should be a sparse collection right? So the MAX value wouldn’t determine the collection size, and shouldn’t affect compares like intersection and such right?

Am I missing something? My intersection function looks like this:

```
int S2MP::numberOfIntersections (const SortedSet<int> &set1, const SortedSet<int> &set2)
{
int i = 0, j = 0;
int m = set1.size();
int n = set2.size();
int intersectionCount = 0;
while (i < m && j < n)
{
if (set1.getUnchecked(i) < set2.getUnchecked(j))
{
i++;
}
else if (set2.getUnchecked(j) < set1.getUnchecked(i))
{
j++;
}
else /* if set1[i] == set2[j] */
{
intersectionCount++;
i++;
j++;
}
}
return intersectionCount;
}
```

Thanks for any thoughts, advice, or help