All pastes #630439 Raw Edit

Anonymous

public text v1 · immutable
#630439 ·published 2007-07-23 06:11 UTC
rendered paste body
heres a cool trick if you need to loop a very large collection:

seems about 10-15% faster than checking the limit every iteration

Code:

            int len = 300000000;
            ushort[] a = new ushort[len];
            
            
            try
            {
                uint ac = 0;
                while (true)
                {
                    a[ac] = 100;
                    ac++;

                }
            }
            catch (IndexOutOfRangeException e2)
            {
            }

// wow that was fast