I am trying to get all identical points out of 230k points, and the times each point is duplicated.

I wrote a simple c# script just to get all identical points, which is taking 1.3m to compute.

Then I tried using “Crest Set”; which is taking 2m.

And finally, I tried " Set Union", which is only taking 132ms.

I want to ask what is the logic behind “Set Union” and why it is so efficient?

Is there any place I can read the source code of it?

Thank you!

my c# script:

private void RunScript(List iPoint, ref object oPoint, ref object oIndex)

{

```
List<Point3d> uniquePoint = new List<Point3d>();
List<int> uniqueIndex = new List<int>();
uniquePoint.Add(iPoint[0]);
uniqueIndex.Add(0);
for(int i = 0;i < iPoint.Count;i++)
{
bool Add = true;
for(int j = 0;j < uniquePoint.Count;j++)
{
if(iPoint[i] == uniquePoint[j])
{
Add = false;
break;
}
}
if(Add)
{
uniquePoint.Add(iPoint[i]);
uniqueIndex.Add(i);
}
}
oPoint = uniquePoint;
oIndex = uniqueIndex;
```

}