[IGNORE ME] (BAD BOT) Math problem about collada merging indices

[Moderator message: this post is a bot. We think the other topic by this account is not a bot, so maybe this account is compromised.]

Hi i’m trying to compare 8 floats in the same array,this array has a size of 100k,my aim is to compare the 8 floats of each element with the 8 floats of the others element and to put the index that have the same value in another array in this case index_merged;

my problem is that in my case it loops for 280 millions times more or less (max case is 10 billions) and execute in 1 minute and 20 seconds on my hardware(trash laptop),i tried everything i know to speed up the process but nothing to do.
My aim is just to get to 20 seconds of execution cause i’m using collada datas,and i will use collada only in debug mode(i will reorder the datas and use another format for an eventual release);
ps: i don’t have stack memory free even for these 8 mb,and i’ve already tried to memcmp but it exectues with 20 seconds more this is the code :

 ///////MERGING
  UINT32 merge_count = 0;
  UINT32 i_boss = 0;   
  for (;i_boss<parser_ptr->indices_count;++i_boss) 
  {
      if(i_boss != index_merged[i_boss])   
      {
         UINT8 check_merge = 0;           
         for (UINT32 i = i_boss;i<parser_ptr->indices_count;++i) 
         {
            check_merge = 0;
            if((i_boss != i) && (i != index_merged[i]))
            {  
               
               for (UINT16 kk = 0;kk < 3; ++kk)
               {
                  if((parser_ptr->proc[i_boss].p_vertices[kk] != parser_ptr->proc[i].p_vertices[kk]))
                  {
                     check_merge = 1; 
                     break; 
                  }
                  if((parser_ptr->proc[i_boss].p_normals[kk] != parser_ptr->proc[i].p_normals[kk]))
                  {
                     check_merge = 1;  
                     break; 
                  }
                  if(kk<2)
                  {
                     if((parser_ptr->proc[i_boss].p_uvs[kk] != parser_ptr->proc[i].p_uvs[kk]) )
                     {
                        check_merge = 1;  
                        break; 
                     }
                  }
                  
               }                 
               if(check_merge == 0)
               {
                  index_merged[i] = i;                                    
                  parser_ptr->i_indices[i] = i_boss; 
                  merge_count++;                    
               }                                      
            }                   
         } 
      }  
   }

I looked over your post because I was certain it’s spam from a chat bot, but assuming not :slight_smile: I don’t know what to tell you but it seems like you’re writing a naive quadratic time algorithm that doesn’t scale. I don’t think this is COLLADA related, so all I can tell you is to use this with large data sets you need a sorted hash table instead of comparing everything to everything.

I’m not sure this is a good forum for these kinds of posts. It’s far off-topic and I think you’ll make people impatient with these posts. I’m writing a reply so others watching this forum don’t have to read over your posts since I already have :slight_smile: I mean this constructively and I hope it doesn’t get me in me trouble speaking as a forum moderator. It is good to learn about quadratic time algorithms, and why to avoid them. Many programmers go on to write a lot of code before ever learning how their code only works because computers are very, very fast these days for many purposes.

Based on the (hidden) reply to this post we’ve determined this account is a bot or was turned into a bot (hacked) and I can’t comment on what the more seasoned moderators will do about it if anything.

[A sample]

you sent a post with a fibonacci title,but the post discard the indices like i did,so i don’t think can be related…in your post it’s like a[10] a [5] == a [7] 7 deleted etc but it’s already what i do,in my loop i have a possibility of 10 billions index 100k * 100k…
and btw your post is in js,so no memory issues or padding etc,i’m using c99

but i’m not a bot,i wrote everything myself,well i’m ok with the deletion of the post np xd

You wrote the following then? It’s in your punctuation style.

“you sent a post with a fibonacci title,but the post discard the indices like i did,so i don’t think can be related…in your post it’s like a[10] a [5] == a [7] 7 deleted etc but it’s already what i do,in my loop i have a possibility of 10 billions index 100k * 100k…
and btw your post is in js,so no memory issues or padding etc,i’m using c99”

yes,i know i should write in a more clear way,btw feel free to totally remove the post cause basically like you said it’s not related to collada(i mean the data are from a collada but nothing else),so i say sorry to you and the forum staff for my behaviour,but i’m not a bot :smiley: i think i’m human bye good work

Since you can’t explain the multiple nonsense statements in that quote we have to assume you’re a bot. At least in this post.