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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:02:16+00:00 2026-05-26T14:02:16+00:00

Working with legacy code, I found I got are lot of statements (more than

  • 0

Working with legacy code, I found I got are lot of statements (more than 500) like this

bool isAEqualsB = (a == b) ? true : false;

Does it make any sense to rewrite it like this ?

bool isAEqualsB = (a == b)

Or will be optimized at compile time ?

Thanks in advance,

Santi! =)

  • 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-26T14:02:17+00:00Added an answer on May 26, 2026 at 2:02 pm

    Ignore the performance – that’s so unlikely to be a bottleneck, it shouldn’t be what you think about until you’ve proved that it’s relevant with appropriate benchmarks.

    I would absolutely care about the readability though – and from that point of view, I consider the second approach to be much better, and would certainly use it.

    EDIT: In terms of optimization, it looks like the C# compiler doesn’t optimize it:

      // First form
      IL_0000:  ldarg.0
      IL_0001:  ldarg.1
      IL_0002:  beq.s      IL_0007
      IL_0004:  ldc.i4.0
      IL_0005:  br.s       IL_0008
      IL_0007:  ldc.i4.1
      IL_0008:  stloc.0
    
      // Second form
      IL_0009:  ldarg.0
      IL_000a:  ldarg.1
      IL_000b:  ceq
      IL_000d:  stloc.1
    

    However, it’s not the IL that will matter of course – it’s what the JIT compiler does. Now even the difference in IL size may mean the difference between inlining and not…

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

Sidebar

Related Questions

I'm working with some legacy code that has an import like so: #import C:\Program
I'm working on legacy code that looks very similar to this: public class BaseParser
Working in some legacy code, I've run across a ton of Try/Catch statements. Try/Catch
I'm working with some legacy code that makes extensive use of this kind of
I am working with this legacy code in a Rails 3 app. # Contacts
We're working in a legacy code base that's got a pretty rough data model.
At work, I am working with this old legacy code modified Cake-PHP code that
I'm working with legacy Java code which returns java.lang.object. I'm passing it into a
I am working with some legacy code, and at some point there is a
I am working on a legacy code where an application uses AxSHDocVw.AxWebBrowser ( not

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.