I am currently developing a tool to remove geometry from a 3D model within a web browser.
During a specific stage of the removal process, I take an array containing indexes and convert it into a Set to eliminate any duplicate indexes.
function TransformArrayIntoSet(array){
return new Set(array);
}
This function initially performed well for most models. To enhance the efficiency of the deletion process, I aimed to avoid solutions that involved using .indexOf.
However, when attempting to delete elements from a large model, such as an array with approximately 15,000,000 entries, I encountered the following error in the browser console:
Uncaught (in promise) RangeError: Set maximum size exceeded
I would like to understand what limits exist when creating a Set. Is this limitation determined by the Browser or the hardware running the Browser? Is there a method to determine this limit? Perhaps if I knew the size constraint of a Set, I could divide the array into multiple Sets and proceed accordingly?