Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Looping Through a million classes in an array

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Nov 24, 2007 10:31 am    Post subject: Looping Through a million classes in an array Reply with quote

People, I have found my method of getting the opcode.

I ran a test:

Code:

            Toy[] toys = new Toy[1000000];
            //init
            Console.WriteLine("Init'ing...");
            for (Int64 i = 0; i < toys.Length; i ++)
            {
                toys[i] = new Toy();
                toys[i].Lul = "number " + i.ToString();
                toys[i].Lol = i;
            }
            Console.WriteLine("Now we start");
            DateTime begin = DateTime.Now;
            Console.WriteLine(begin.ToString());

            Toy t = Array.Find<Toy>(toys, mypred);
            Console.WriteLine(t.Lol);
            Console.WriteLine(t.Lul);

            DateTime end = DateTime.Now;
            Console.WriteLine(end.ToString());

            TimeSpan elapsed = end.Subtract(begin);
            Console.WriteLine(elapsed.ToString());

            Console.ReadLine();
        }

        private static bool mypred(Toy t)
        {
            return t.Lul == "number 999999";
        }
    }

    public class Toy
    {
        public Int64 Lol = 0;
        public string Lul = "";       
    }


The result was this:

Code:

Init'ing...
Now we start
11/24/2007 10:26:00 AM
999999
number 999999
11/24/2007 10:26:00 AM
00:00:00.0781250


So that's an elapsed time of

78 thousandths of a second, to loop through a million classes in an array.

Some simple math here,

Code:

0.078 / 1000000 = 0.000000078


So that's... 78 one-hundred-thousandths of a second per one element in an array.

=D
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites