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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:41:39+00:00 2026-06-09T02:41:39+00:00

I have two question: 1) I need some expert view in terms of witting

  • 0

I have two question:

1) I need some expert view in terms of witting code which will be Performance and Memory Consumption wise sound enough.

2) Performance and Memory Consumption wise how good/bad is following piece of code and why ???

Need to increment the counter that could go maximum by 100 and writing code like this:

Some Sample Code is as follows:


for(int i=0;i=100;i++)
{
     Some Code
}

for(long i=0;i=1000;i++)
{
     Some Code
}

how good is to use Int16 or anything else instead of int, long if the requirement is same.

  • 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-09T02:41:41+00:00Added an answer on June 9, 2026 at 2:41 am

    Need to increment the counter that could go maximum by 100 and writing code like this:

    Options given:

    for(int i=0;i=100;i++)
    
    for(long i=0;i=1000;i++)
    

    EDIT: As noted, neither of these would even actually compile, due to the middle expression being an assignment rather than an expression of type bool.

    This demonstrates a hugely important point: get your code working before you make it fast. Your two loops don’t do the same thing – one has an upper bound of 1000, the other has an upper bound of 100. If you have to choose between “fast” and “correct”, you almost always want to pick “correct”. (There are exceptions to this, of course – but that’s usually in terms of absolute correctness of results across large amounts of data, not code correctness.)

    Changing between the variable types here is unlikely to make any measurable difference. That’s often the case with micro-optimizations. When it comes to performance, architecture is usually much more important than in-method optimizations – and it’s also a lot harder to change later on. In general, you should:

    • Write the cleanest code you can, using types that represent your data most correctly and simply
    • Determine reasonable performance requirements
    • Measure your clean implementation
    • If it doesn’t perform well enough, use profiling etc to work out how to improve it
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the question states, I have two ethernet devices I need to use. A
I have two examples I have a question about. Let me explain via some
I have two views of some data: a list view (a ListBox now, but
This is a basic question but I need some help with it. I have
I have two question to put forward: I was very interested, even intrigued by
guys I have two question to ask, they're easy, but bothering me for a
This is two part question: I have two stored procedures: sp1 & sp2. If
I have a question: I have two MSSQL tables, items and states, that are
I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine
Question I have two compilers on my hardware C++ and C89 I'm thinking about

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.