| I really wish there was conditional compilation in Java
// Test NFC Performance
PerfTest.Function TestJDK_NFC_NFD_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < NFDFileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(NFDFileLines[i], sun.text.Normalizer.COMPOSE,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < NFDFileLines.length; i++) {
totalChars = totalChars + NFDFileLines[i].length();
}
return totalChars;
}
};
}
PerfTest.Function TestJDK_NFC_NFC_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < NFCFileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(NFCFileLines[i], sun.text.Normalizer.COMPOSE,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < NFCFileLines.length; i++) {
totalChars = totalChars + NFCFileLines[i].length();
}
return totalChars;
}
};
}
PerfTest.Function TestJDK_NFC_Orig_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < fileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(fileLines[i], sun.text.Normalizer.COMPOSE,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < fileLines.length; i++) {
totalChars = totalChars + fileLines[i].length();
}
return totalChars;
}
};
}
// Test NFD Performance
PerfTest.Function TestJDK_NFD_NFD_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < NFDFileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(NFDFileLines[i], sun.text.Normalizer.DECOMP,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < NFDFileLines.length; i++) {
totalChars = totalChars + NFDFileLines[i].length();
}
return totalChars;
}
};
}
PerfTest.Function TestJDK_NFD_NFC_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < NFCFileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(NFCFileLines[i], sun.text.Normalizer.DECOMP,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < NFCFileLines.length; i++) {
totalChars = totalChars + NFCFileLines[i].length();
}
return totalChars;
}
};
}
PerfTest.Function TestJDK_NFD_Orig_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < fileLines.length; i++) {
String nfc = sun.text.Normalizer.normalize(fileLines[i], sun.text.Normalizer.DECOMP,0);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < fileLines.length; i++) {
totalChars = totalChars + fileLines[i].length();
}
return totalChars;
}
};
}
// Test FCD Performance
PerfTest.Function TestICU_FCD_NFD_Text() {
return new PerfTest.Function() {
public void call() {
for (int i = 0; i < NFDFileLines.length; i++) {
String nfc = Normalizer.normalize(NFDFileLines[i], Normalizer.FCD);
}
}
public long getOperationsPerIteration() {
int totalChars = 0;
for (int i = 0; i < NFDFileLines.length; i++) {
totalChars = totalChars + NFDFileLines[i].length();
}
return totalChars;
}
};
}
|