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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:58:41+00:00 2026-05-27T23:58:41+00:00

For example: ; Method 1 .data val1 DWORD 10000h .code add eax,val1 v.s: ;

  • 0

For example:

; Method 1
.data
val1 DWORD 10000h
.code
add eax,val1

v.s:

; Method 2
.code
add eax,10000h

Which method would execute faster after being compiled (assembled)?
I’m thinking method 2 would produce faster code because the CPU won’t have to read value from main memory before adding up to eax register. I’m not so clear in my answer, could somebody help?

  • 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-27T23:58:42+00:00Added an answer on May 27, 2026 at 11:58 pm

    10000h will be read from memory no matter what – either from its location in the data memory, or from its location in the instruction memory. For smaller constant values CPUs provide special instructions that do not require an additional space for the value being added, but this depends on the specific architecture. The add immediate will probably be faster because of caching: by the time the instruction is decoded, the constant will be in cache, and the addition will be very quick.

    Small off-topic note: your example shows a case when an optimizing C compiler would produce a faster code than a hand-written assembly: instead of adding 10000h, optimizer may increment the upper half-word by one, and leave the lower half-word as is.

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

Sidebar

Related Questions

The HTML that is rendered seems right: <a href=/foo/add data-method=post data-remote=true rel=nofollow><img src=/assets/icons/example.png></a> Inspite
I have created a BinaryTreeNode<T> class and then creating Add(T data) method for BinaryTree<T>
I use in my code calls to HttpWebRequest.BeginGetResponse() method to get data from my
I am using jquery data tables server side method example here http://www.datatables.net/examples/server_side/server_side.html My JSON
I am wondering which is a more efficent method to retrieve data from the
I am trying a simple Extension Method example and am unable to increment or
Update: Replaced the destructor example with a straight up method call example. Hi, If
I want to fetch a method's comments,take below method for example: /** * Returns
I start to use Java annotations heavily. One example is taking method with annotations
Example: I have a method -myFooBarMethod:withFoo:bar:moreFoo: and inside the implementation of that method I

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.