Library tutorials & articles
Iteration Methods
- Introduction
- More Methods
- Conclusions
Conclusions
To test the different methods, I allocated 1,000,000 doubles into an array and indexed over all of them. I repeated this 1,000 times to minimize randomness. Here are the results...
Enumeration is always slow. That’s not surprising as I’m using a general data structure to hold the doubles. Each access performs a cast. The three operator/property methods differed very slightly. These are probably all optimized similarly. Using pointer math to traverse over the raw data was significantly faster. This is probably due to the fact that there’s no bounds checking. In summary, if you have large amounts of data and performance is critical, consider using managed C++.
Acknowledgements
Thanks to Mark Vulfson of ProWorks for tips on using Flipper Graph Control. Also, to my colleagues Ken Baldwin and Steve Sneller at CenterSpace Software.Related articles
Related discussion
-
What is C#
by Thushan Fernando (8 replies)
-
Schema Data from OLAP
by odin (0 replies)
-
Popup Window
by rajasahekar (3 replies)
-
Capture tab key
by kyledunn (3 replies)
-
Updating source with data adapter
by kyledunn (0 replies)
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Applicatie ontwikkelaar binnen Defensie
in Amsterdam (£50K-£90K per annum) -
Microsoft Dynamics CRM Technical Consultant
in Netherlands (€50K-€90K per annum) -
Front End Developer
in Hammersmith (£45K-£60K per annum)
Events coming up
-
Nov
19
C# 3.0 and LINQ with Visual Studio 2008 Training Course
London, United Kingdom
This course has been developed to help existing C#.NET 2.0 programmers and developers upgrade their .NET development skills and learn about the new features of Microsoft's C# 3.0 and LINQ to XML and ADO.NET using Visual Studio 2008 (currently codenamed Orcas).
Thanks for the feedback! I tried putting in the extra step. The results are virtually unchanged from previous changes. Please try it out yourself.
Cheers,
Trevor
Trevor Misfeldt
CEO, CenterSpace Software
You are merely accessing the reference to where the data is kept for the array, but are never actually accessing the data, which you do elsewhere (for example Method #2). If you were to actually access the data, then I think your method would perform similar to Method #2. I don't think that the actual data is read until you access the variable. So perhaps to complete the test, I would perform a d += 1 in each loop to make sure that the data is accessed by each method your base class in which the object exists.