Posts Tagged ‘Benchmarks’

My Java Benchmarks on GitHub

Hi,
I’ve created a new github repository for my Java Benchmarks : java-benchmarks
From now all my benchmarks will be pushed to this repository. This is more simple for me to manage and more secure also.
At this time, there is seven benchmarks on the repository :

Closest Pair Search Benchmark : A benchmark to test two closest pair point search algorithms : the naive one and the …

Java Synchronization (Mutual Exclusion) Benchmark

I’ve created another benchmark. This time, I’ve benchmarked the different ways of synchronizing a little code using mutual exclusion on this code.
The code to protect will be very simple. It’s a simple counter :

//Init
int counter = 0;
 
//Critical section
counter++;

The critical section, if not protected with synchronization system, will not function properly due to possible interleavings (read the article on synchronization if you don’t know …

Java File Copy Benchmark Updates (once again)

I’ve made another updates to my file copy benchmark.
First of all, I used my little utility class to automatically create the graphs. The graph are a little less clean, but I spare a lot of time not creating them myself.
Then, I’ve also made some corrections on the code :

I”ve used a buffer size of 8192 instead of 4096
I’ve made some corrections using the channels …

Generate graphs benchmarks easily

After launching a lot of benchmarks for file copy benchmark and always generating the graphs from the results in Excel, I realized that I was loosing a lot of time to do that. So like any Java developer, I decided to create a little tool that do the work automatically for me.
For creating benchmarks, I’m using a little micro-benchmarking framework, described here. After the …

Java File Copy Benchmarks Update

I’ve made an update of my benchmark about file copy methods in Java. I’ve been asked for new informations about this benchmark and for new test, so I’ve included more results and informations.
This new version include two new complete benchmarks :

Benchmark on the same disk (Ext4)
Benchmark between two disks (Ext4 -> Ext4)

And of course the old benchmark is always here : Benchmark between two …

File copy in Java – Benchmark

Yesterday I wondered if the copyFile method in JTheque Utils was the best method or if I need to change. So I decided to do a benchmark.
So I searched all the methods to copy a File in Java, even the bad methods and found 5 methods :

Native Copy : Make the copy using the cp executable of Linux
Naive Streams Copy : Open two streams, …

Find closest pair of point with Plane Sweep Algorithm in O(n ln n)

Finding the closest pair of Point in a given collection of points is a standard problem in computational geometry. In this article I’ll explain an efficient algorithm using plane sweep, compare it to the naive implementation and discuss its complexity.

How to write correct benchmarks

Several months ago, I wrote an article to compare the performances of short indexes for loops. I wrote that code to achieve my goal :

package com.wicht.old;
 
public class TestShortInt {
public static void main(String[] args){
long startTime = System.nanoTime();
 
int resultInt = 0;
 
for (int i = 0; i < 100000; i++){
for (int j = 0; j < 32760; j++){
resultInt += i * j;
}
}
 
System.out.println("Temp pour int : " + …

Tip : Don’t use shorts for loop indexes !

After a post I read on a french forum, i asked myself of the performances using shorts as loop indexes for loop with few iterations (less than 32768).
At first view, it can be tempting because we save 2 octets, so why use an int instead a short ?
But, when we think of that, we see that the int is more adapted. Indeed, it’s more …