Stringing Along

How much slower is a Java String object comparison, compared to a primitive int comparison? I was curious, so I made a little Android app to compare an array of integers and Strings 10 million times each.

package test.benchstring;

import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class BenchStringActivity extends Activity {
int MAX = 10000000;
int[] arrayInt = {0

Leave a Reply

Your email address will not be published. Required fields are marked *