Does a sorted array run faster than an unsorted array in Java?

In this video, Brian L. Gorman uncovers the relationship between efficiency and branch prediction when executing arrays in Java.

By Brian L. Gorman
October 19, 2016
Screenshot from "Does a sorted array run faster than an unsorted array in Java?" Screenshot from "Does a sorted array run faster than an unsorted array in Java?"

On the surface, it may appear that sorted arrays run faster than non-sorted arrays. Many novice developers would be surprised to learn that this is not the case. In this video Brian L. Gorman proves the close similarity in execution time between sorted and unsorted arrays, and demonstrates how the efficiency of branch prediction can be vastly improved when coupled with a check condition.

Sign up for Safari now and get 10 days of free access to more Java training.

Learn faster. Dig deeper. See farther.

Join the O'Reilly online learning platform. Get a free trial today and find answers on the fly, or master something new and useful.

Learn more

Brian L. Gorman is an experienced .NET developer, certified as an MCSD in C# .NET. Holding a Masters of Science in computer information systems, he has many years of experience instructing college-level SQL database, C#, VB.NET, Java, and Microsoft Office courses. Brian has also authored a number of full video courses on these subjects.

Post topics: Software Engineering
Post tags: Questions
Share: