Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6875733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:23:26+00:00 2026-05-27T04:23:26+00:00

Does anyone see any issues with this basic test? var GC_MemoryStart = System.GC.GetTotalMemory(true); Stopwatch

  • 0

Does anyone see any issues with this basic test?

var GC_MemoryStart = System.GC.GetTotalMemory(true);
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var test = new InquiryServiceTypeData().GetActive(true);
stopWatch.Stop();
var GC_MemoryEnd = System.GC.GetTotalMemory(true);
arrayTotal[i] = (stopWatch.ElapsedTicks * 1000.0) / Stopwatch.Frequency;
size[i] = GC_MemoryEnd - GC_MemoryStart;

Just trying to get a general estimate of how long the method takes to run and how much memory in the heap it uses.

Aka, some of the tests use dataset/datatables, some use lists, and some use both.

This code is thrown in a loop so that I can change the number of iterations. I then display the average time each method takes and the average size.

EDIT: The GetActive method accesses a database and returns data. The different methods that I’m measuring process the data returned in a different way.

Method 1 – Returns a data into a dataset and then converts to an object list.
Method 2 – Returns a datareader and converts to an object list.
Method 3 – A merging of the first 2 methods.

The reason for the code is to settle a disagrement with a coworker. He thinks my code was crap because the datareader and converting to an object list has a ton of ‘new’ statements which places a load on the heap. I argue that he’s wrong. So I want to show him metrics because he didn’t listen to any of my logical statements. You can’t argue with numbers though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:23:27+00:00Added an answer on May 27, 2026 at 4:23 am

    That’s pretty good.

    However, you should call the method once before you time anything so that you don’t end up timing the JITter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
Does anyone see a problem with this, its not working saying bad file descriptor
Does anyone know of any issues with VS 2003/2005 and 2008 co-existing on the
Does anyone else see this issue? I am using a segmented control, and I've
Does anyone have experience using the URL Rewrite Module (see here )? Can it
Does anyone know how I can check to see if a directory is writeable
Does anyone have metrics on the utility of formal Unit Testing? I see a
I see a lot of IoC frameworks for .Net and Java. Does anyone know
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone remember the XMP tag? What was it used for and why was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.