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

  • Home
  • SEARCH
  • 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 7530277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:52:07+00:00 2026-05-30T04:52:07+00:00

Does any one know what is the performance impact when using many parameters in

  • 0

Does any one know what is the performance impact when using many parameters in constructor (10+) compared to setters?

I my case the model object is not valid without any of those parameters, so I am using single constructor.

I know that there is not significant difference either way, but I am asking if anyone knows whats actually going on in both cases.

I am asking for performance because the application is Android application that can be run on older devices without JIT.

Also it would be nice if we know the optimal solution.

  • 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-30T04:52:08+00:00Added an answer on May 30, 2026 at 4:52 am

    The performance implication of using the setters vs. the constructor is negligible, because roughly the same thing is going on in both instances: data passed to a method gets stored in an instance variable.

    With ten setters you pay the price for nine additional method calls, but they are so extremely cheap that you are not likely to find any difference, especially if they get inlined by JIT compiler.

    Logical implications are a lot more severe: if your object is not valid until you set all ten instance variables, then you definitely need to use a constructor with ten parameters: performance gains, real or not, are secondary to the logical integrity of your class, which should not be compromised.

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

Sidebar

Related Questions

Does anyone know whether there are any performance trade-offs/advantages to assigning an object's fields
Does anyone know if there is any performance penalty if one compiles C code
does any one know how to get the current motherboard, processor or HD temperature
Does any one know how can I convert a BSTR to an int in
Does any one know of a way to control how Visual Studio handles curly
Does any one know of a control that i can use with a ASP.Net
Does any one know a good way to do remote procedure calls in windows
Does any one know from where can I download source code for Cassini. I
Does any one know how can I cut the 1st 3 char in a
Does anyone know an elegant way to determine System Load preferably using Windows performance

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.