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 358889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:20:32+00:00 2026-05-12T12:20:32+00:00

(This was meant to be a general hypothetical question, me whining that .NET was

  • 0

(This was meant to be a general hypothetical question, me whining that .NET was a pig and begging for reasons. It was not really meant to be a question about my specific app.)

Currently I am rewriting some old C++ code in C#. We are porting over all legacy applications. I have C++ applications that take MAX 3% CPU. Mostly they use none. I then take the code, copy and paste, then reformat to C# syntax and .NET libraries, and BAM! 50% CPU. Whats the reason for this? I thought at first it was JIT, but even after each code path has been exercises, and the whole thing has been JIT ed, same issue.

I have also noticed huge memory increases. Apps that took 9 MB running a full load now start at 10 MB and run at 50 MB. I realize hardware is cheap, but I want to understand what causes this. Is it a cause for alarm, or is .NET just that much the pig?

Update 1 Answer to Skeet

I am familiar with C#. I change things to Linq, and so on. I typically take code and reduce the number of lines, and so on. Could you give some more examples of what a C++ person my do wrong in .NET?

Update 2

This was meant to be a general question, but the specific app that has the issue is as follows.

It has a thread that uses and ODBC driver to get data from a paradox db. It then uses Linq to transform this to a SQL db and post it. I have run it through ANTS profiler, and it seems the data set filling take the most time. Followed by Linq posting. I know some of my areas are reflection usage, but I don’t see how to do what I need to with out this. I plan to change my string to string builders. Is there any difference between these two?

(int)datarow["Index"]

and

ConvertTo.Int32(datarow["Index"])

I changed all string concatenation to format strings. That didn’t reduce over head. Does any one know the difference between a data reader vs data adapter and datasets?

  • 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-12T12:20:32+00:00Added an answer on May 12, 2026 at 12:20 pm

    How familiar are you with C# and .NET? If you’re just porting over the legacy code keeping C++ idioms, I’m not at all surprised that it’s being a hog. Porting applications verbatim from one platform to another is almost never a good idea. (Of course, you haven’t said that you’ve definitely done that.) Also, if you’re expert C++ developers but novice .NET developers, you should expect your code to perform as if you’re novices on the platform.

    We can’t really tell what’s taking the performance without knowing more about the app – although I wouldn’t be surprised to hear that string concatenation was the culprit. How many processors do you have on the box? If it’s 2, then the app is basically taking up everything it can for a single thread…

    .NET is generally going to be heavier in terms of memory than a C++ app, but should be at least comparable in terms of speed for most tasks. Taking 50MB instead of 9MB sounds like more than I’d expect, but I wouldn’t immediately be too worried.

    Both the memory and the CPU performance should be investigated with the use of a good profiler. I can recommend JetBrains dotTrace Profiler, but there are plenty of others out there.

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

Sidebar

Related Questions

This question is meant to apply to interfaces in general, but I'll use AS3/Flex
Disclosure This is a general question, perhaps without a specific answer, but it is
This isn't meant as a troll or flamebait or anything like that. I've been
Parsing the string message seems bad. Or was this exception not meant to be
[i meant to ask this question on StackOverflow...] I have been using VisualSVN Server
This question isn't meant as flame-bait! As it might be apparent, I've been looking
I'm sure it is meant to be like this (e.g. not a bug or
Reference: This is a self-answered question. It was meant to share the knowledge, Q&A
this question is about best practices. I'm implementing a 3D interval Kd-Tree and, because
This question is a general one, and I've already posted a version of it

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.