-
Bug
-
Resolution: Won't Fix
-
P4
-
8
-
x86
-
linux
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
On this page it lists -XX:+UseCompressedStrings as on by default.
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
However in Java 6 update 29 its off by default and in Java 7 update 2 it reports
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseCompressedStrings; support was removed in 7.0
The program below requires a heap of 2000m on Java 7, 1800m on Java 6 without compressed Strings and 1000m with compressed Strings. Its also faster with compressed Strings turned on.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try Java 6 and 7 with and without UseCompressedStrings
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Options to improve performance to retained
OR
The documentation to reflect which options are available. A note as to why its not available would be very interesting.
ACTUAL -
Neither
ERROR MESSAGES/STACK TRACES THAT OCCUR :
OutOfMemoryError if you don't have 2 GB for the heap.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String... args) throws IOException {
long start = System.nanoTime();
generateFile("lines.txt", 755 * 1024 * 1024, 189000);
List<String> lines = loadLines("lines.txt");
System.out.println("Sorting file");
Collections.sort(lines);
System.out.println("... Sorted file");
// save lines.
long time = System.nanoTime() - start;
System.out.printf("Took %.3f second to read, sort and write to a file%n", time / 1e9);
}
private static void generateFile(String fileName, int size, int lines) throws FileNotFoundException {
System.out.println("Creating file to load");
int lineSize = size / lines;
StringBuilder sb = new StringBuilder();
while (sb.length() < lineSize) sb.append('-');
String padding = sb.toString();
PrintWriter pw = new PrintWriter(fileName);
for (int i = 0; i < lines; i++) {
String text = (i + padding).substring(0, lineSize);
pw.println(text);
}
pw.close();
System.out.println("... Created file to load");
}
private static List<String> loadLines(String fileName) throws IOException {
System.out.println("Reading file");
BufferedReader br = new BufferedReader(new FileReader(fileName));
List<String> ret = new ArrayList<String>();
String line;
while ((line = br.readLine()) != null)
ret.add(line);
System.out.println("... Read file.");
return ret;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use older version of Java until fixed.
SUPPORT :
YES
A DESCRIPTION OF THE PROBLEM :
On this page it lists -XX:+UseCompressedStrings as on by default.
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
However in Java 6 update 29 its off by default and in Java 7 update 2 it reports
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseCompressedStrings; support was removed in 7.0
The program below requires a heap of 2000m on Java 7, 1800m on Java 6 without compressed Strings and 1000m with compressed Strings. Its also faster with compressed Strings turned on.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try Java 6 and 7 with and without UseCompressedStrings
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Options to improve performance to retained
OR
The documentation to reflect which options are available. A note as to why its not available would be very interesting.
ACTUAL -
Neither
ERROR MESSAGES/STACK TRACES THAT OCCUR :
OutOfMemoryError if you don't have 2 GB for the heap.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String... args) throws IOException {
long start = System.nanoTime();
generateFile("lines.txt", 755 * 1024 * 1024, 189000);
List<String> lines = loadLines("lines.txt");
System.out.println("Sorting file");
Collections.sort(lines);
System.out.println("... Sorted file");
// save lines.
long time = System.nanoTime() - start;
System.out.printf("Took %.3f second to read, sort and write to a file%n", time / 1e9);
}
private static void generateFile(String fileName, int size, int lines) throws FileNotFoundException {
System.out.println("Creating file to load");
int lineSize = size / lines;
StringBuilder sb = new StringBuilder();
while (sb.length() < lineSize) sb.append('-');
String padding = sb.toString();
PrintWriter pw = new PrintWriter(fileName);
for (int i = 0; i < lines; i++) {
String text = (i + padding).substring(0, lineSize);
pw.println(text);
}
pw.close();
System.out.println("... Created file to load");
}
private static List<String> loadLines(String fileName) throws IOException {
System.out.println("Reading file");
BufferedReader br = new BufferedReader(new FileReader(fileName));
List<String> ret = new ArrayList<String>();
String line;
while ((line = br.readLine()) != null)
ret.add(line);
System.out.println("... Read file.");
return ret;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use older version of Java until fixed.
SUPPORT :
YES