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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:54:36+00:00 2026-06-04T07:54:36+00:00

Are there any tangible performance penalties for having a large number of variables, properties,

  • 0

Are there any tangible performance penalties for having a large number of variables, properties, and/or methods in a single C# class?

I have several classes (a chess board, move generator, and a PGN parser) that total about 1,200 lines of code. Both the move generator and the parser are very tightly coupled to the board class, and there is a strong temptation to simply combine all three classes into a single large “kitchen sink” class.

I understand and applaud the concept of keeping each class focused on a single task and cleanly encapsulating their internal design, but since using .NET is a non-negotiable requirement, I’m also willing to sacrifice “purity of design” in return for performance

Other than the obvious issues of readability/maintainability, what are the downsides to having a smaller number of large complex classes, as opposed to a larger number of smaller simple classes?

Cheers!
Humble Programmer
,,,^..^,,,

  • 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-06-04T07:54:37+00:00Added an answer on June 4, 2026 at 7:54 am

    Are there any tangible performance penalties for having a large number of variables, properties, and/or methods in a single C# class?

    Having more variables causes instances to have higher memory usage and potentially longer construction times – this can have a penalty if the variables aren’t necessarily needed in every circumstance.

    That being said, the main disadvantages are more in terms of reliability, maintainability, testability.

    I understand and applaud the concept of keeping each class focused on a single task and cleanly encapsulating their internal design, but since using .NET is a non-negotiable requirement, I’m also willing to sacrifice “purity of design” in return for performance

    .NET has nothing to do with making horrible code – you can have good design and .NET in the same project, and this is, in fact, quite simple to accomplish.

    I have several classes (a chess board, move generator, and a PGN parser) that total about 1,200 lines of code. Both the move generator and the parser are very tightly coupled to the board class, and there is a strong temptation to simply combine all three classes into a single large “kitchen sink” class.

    I would consider trying to find the motivation to refactor this and decouple it into more, smaller classes. This is likely to help in every way, including performance (if you find it necessary), as it’s typically simpler to fix a performance problem in a clean, well thought-out design than it is to find or fix a performance issue in a tightly coupled, large codebase. Smaller classes are easier to profile and measure, which in turn allows the real performance problems (if any) to be discovered and corrected much more simply than when working from a large mess of code.

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

Sidebar

Related Questions

Is there any tangible difference between the two forms of syntax available for creating
Is there any tangible difference (speed/efficiency) between these statements? Assume the column is indexed.
Are there any advantages of using wildcard-type generics in the Bar class over completely
Is there any way to improve the performance of the following CTE query (
Is there any query which can return me the number of revisions made to
Is there any known way of listing the WMI classes and their properties available
Is there any way to bind to all the number keys in Tkinter? It
Are there any out of the box solutions to have conditional formatting of HTML
Is there any way to count the number of currently connected clients in a
Is there any way to get the number of distinct groups in a distributed

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.