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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:20:40+00:00 2026-05-23T23:20:40+00:00

In Java6 both quicksort and mergesort were used in Arrays#sort , for primitive and

  • 0

In Java6 both quicksort and mergesort were used in Arrays#sort, for primitive and object arrays respectively. In Java7 these have both changed, to DualPivotQuicksort and Timsort.

In the source for the new quicksort, the following comment appears in a couple of places (eg line 354):

 /*
  * Here and below we use "a[i] = b; i++;" instead
  * of "a[i++] = b;" due to performance issue.
  */

How is this a performance issue? Won’t the compiler will reduce these to the same thing?

More broadly, what is a good strategy for investigating this myself? I can run benchmarks, but I’d be more interested in analysing any differences in the compiled code. However, I don’t know what tools to use etc.

  • 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-23T23:20:40+00:00Added an answer on May 23, 2026 at 11:20 pm

    This is only an answer to the general question.

    You can look at the bytecode and try to understand the differences. I.e. you could write yourself a simple example using both a[i] = b; i++; and a[i++] = b; and see whats the difference.

    The simplest way to show the bytecode is the javap program (should be included in you JDK). Compile the code with javac SomeFile.java and run javap on the code: javap -c SomeFile (the -c switch tells javap to output the bytecode for each method in the file).

    If you are using eclipse you could also try this one.

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

Sidebar

Related Questions

Java 6's Arrays.sort method uses Quicksort for arrays of primitives and merge sort for
So I have got my Maven build deploying both Java5 and Java6 versions to
I have a JSF web client and a Java client that both use the
At a new job I started, we have both a Java application that handles
I have a project folder like this: project/ cow/ a.java horse/ b.java both a.java
I have recently started working on an app which has both Java and native
Does anyone have tried to implement an app in GAE having both java and
I was wondering recently why do both java.lang.Runtime and java.lang.System have the same methods
I have a Leiningen project that is compiling both Java and Clojure files. The
I use Eclipse for both Java and Flex development. Recently, I changed its color

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.