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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:03:14+00:00 2026-06-14T16:03:14+00:00

I’m attempting to test some benchmarking tools by running them against a simple program

  • 0

I’m attempting to test some benchmarking tools by running them against a simple program which increments a variable as many times as possible for 1000 milliseconds.

How many incrementations of a single 64 bit number should I expect to be able to perform on an intel i7 chip on the JDK for Mac OS X ?

My current methodology is :

  • start thread (t2) that continually increments “i” in an infinite loop (for(;;;)).
  • let the main thread (call it t1) sleep for 1000 milliseconds.
  • have t1 interrupt (or stop, since this deprecated method works on Apple’s JDK 6) t2.

Currently, I am reproducibly getting about 2E8 incrementations (this is tabulated below: the value shown is the value that is printed when the incrementing thread is interrupted after a 1000 millisecond sleep() in the calling thread).

217057470

223302277

212337757

215177075

214785738

213849329

215645992

215651712

215363726

216135710

How can I know wether this benchmark is reasonable or not, i.e., what is the theoretical fastest speed at which an i7 chip should be able to increment a single 64-bit digit? This code is running in the JVM and is below:

package net.rudolfcode.jvm;

/**
 * How many instructions can the JVM exeucte in a second?
 * @author jayunit100
 */
public class Example3B {
public static void main(String[] args){
    for(int i =0 ; i < 10 ; i++){
        Thread addThread = createThread();
        runForASecond(addThread,1000);
    }
}


private static Thread createThread() {
    Thread addThread = new Thread(){
        Long i =0L;
        public void run() {
            boolean t=true;
            for (;;) {
                try {
                    i++;
                } 
                catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        @Override
        public void interrupt() {
            System.out.println(i);
            super.interrupt();
        }

    };
    return addThread;
}


private static void runForASecond(Thread addThread, int milli) {
    addThread.start();
    try{
        Thread.sleep(milli);
    }
    catch(Exception e){

    }
    addThread.interrupt();
    //stop() works on some JVMs...
    addThread.stop();
}

}
  • 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-14T16:03:16+00:00Added an answer on June 14, 2026 at 4:03 pm

    Theoretically, making some assumptions which are probably not valid:

    • Assume that a number can be incremented in 1 instruction (probably not, because you’re running in a JVM and not natively)
    • Assume that a 2.5 GHz processor can execute 2,500,000,000 instructions per second (but in reality, it’s more complicated than that)

    Then you could say that 2,500,000,000 increments in 1 second is a “reasonable” upper bound based on the simplest possible back-of-the-envelope estimation.

    How far off is that from your measurement?

    • 2,500,000,000 is O(1,000,000,000)
    • 2E8 is O(100,000,000)

    So we’re only off by 1 order of magnitude. Given the wildly unfounded assumptions – sounds reasonable to me.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from

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.