Alright. So I have a very large amount of binary data (let's say, 10GB) distributed over a bunch of files (let's say, 5000) of varying lengths.
I am writing a Java ... |
I have a the following scenarios. I am trying to calculate throughput of the java's XSLT transformer. I have 10 threrads, each iterates 1000 times. The task of the thread is ... |
Assuming I have an ArrayList
ArrayList<MyClass> myList;
And I want to call toArray, is there a performance reason to use
MyClass[] arr = myList.toArray(new MyClass[myList.size()]);
over
MyClass[] arr = myList.toArray(new MyClass[0]);
?
I prefer the second style, since ... |
I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to enable 3D acceleration for 2D, but even using that has some weird issues.
Here are results of ... |
We recently upgraded to Castor 1.2 from version 0.9.5.3 and we've noticed a dramatic drop in performance when calling unmarshal on XML. We're unmarshaling to java classes that were generated ... |
I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image.
The image size is ... |
Is there any performance reason to declare method parameters final in Java?
As in:
public void foo(int bar) { ... }
Versus:
public void foo(final int bar) { ... }
Assuming that bar is only read ... |
|
I'm exploring the possibility of running a Java app on a machine with very large amounts of RAM (anywhere from 300GB to 15TB, probably on an SGI Altix 4700 machine), and ... |
In Java, what are the performance and resource implications of using
System.currentTimeMillis()
vs.
new Date()
vs.
Calendar.getInstance().getTime()
As I understand it, System.currentTimeMillis() is the most efficient. However, in most applications, that long value would need ... |
Is Java a suitable alternative to C / C++ for realtime audio processing?
I am considering an app with ~100 (at max) tracks of audio with delay lines (30s @ 48khz), filtering ... |
I need to create a data transfer object, which I will use for storing the records retrieved from database. In this data transfer object, I need to declare a numeric field. ... |
I want to do some timing tests on a Java application.
This is what I am currently doing:
long startTime = System.currentTimeMillis();
doSomething();
long finishTime = System.currentTimeMillis();
System.out.println("That took: "+(finishTime-startTime)+ " ms");
Is there anything "wrong" with ... |
for a homework assignment I was given a Card class that has enumerated types for the Rank and Suit. I am required to compare two pokerhands (each hand is an ArrayList ... |
We have a huge (old legacy java) code-base, where many files (around 5k) have System.out.println's. We are planning to remove them for cleanup/performance reasons. How can we write a script that ... |
I've read plenty of articles about tuning GC in Java and have often wondered how many people really use some of the more advanced features.
I've always avoided tuning where possible and ... |
Consider the following two snippets, with braces:
switch (var)
{
case FOO:
{
x = x + 1;
break;
}
case BAR:
...
|
Does XtUnit support performance testing?
|
I've just finished my entry for the 14th Ludum Dare 48-hours game making competition yesterday, and decided to do it in java using java2d for the graphics.
I'm not ... |
I have observed a great difference in Sun Java performance when code is compiled through jdk1.6 as compared to jdk1.5 or jdk1.4 (over 4 folds)
What changes and optimizations have been done? ... |
Is they say that sun's java is opensource now - then can I compile all the patform from sources ?
I used gentoo and I found a great performance inmrovement wnen I ... |
We have an enterprise java application(ear - few ejb's and a webapp) deployed on to weblogic 10 and using Sun java 5. The response time , CPU and memory usage is ... |
I'm working with Java project that requires very advanced manipulations of images. In fact, I'm doing most of the manipulation using OpenCV, and I'm using JNI to wrap around the OpenCV ... |
In Hidden Features of Java the top answer mentions Double Brace Initialization, with a very enticing syntax:
Set<String> flavors = new HashSet<String>() {{
add("vanilla");
...
|
For small logical programs that can be done in a text editor, for tracing I use the classic System.out.println().
I guess you all know how frustrating it is to use that in ... |
Let's say I have a class which, internally, stores a List of data:
import java.util.List;
public class Wrapper
{
private List<Integer> list;
public Wrapper(List<Integer> list)
...
|
If I have a reference to a class and invoke a method on it, and the class or the method is final, my understanding is that the compiler or the JVM ... |
In Java, is it faster to iterate through an array the old-fashioned way,
for (int i = 0; i < a.length; i++)
f(a[i]);
Or using the more concise form,
for (Foo ...
|
I'm looking for a white paper or online book/tutorial about coding efficiently in Java. I've read the white paper from Sun on Performance Tuning (which was mostly about JVM settings) and ... |
Is there a performance difference between these two pieces of code? My gut feeling is that the second option is slower, as the Cell object has to be constructed each ... |
I have an interpreter written in Java. I am trying to test the performance results of various optimisations in the interpreter. To do this I parse the code and then repeatedly ... |
Given these two commands
A:
$ java -Xms10G -Xmx10G myjavacode input.txt
B:
$ java -Xms5G -Xmx5G myjavacode input.txt
I have two questions:
- Since command A reserves more memory with its parameters, will A run faster than B? ...
|
I work in the maintenance team of a big project (around 7k+ classes) and my daily work is mainly to fix bugs. Sometimes, though, I have no bugs to work in. ... |
I frequent wrap code in a System.nanoTime() pair in order to timing it. Something like:
long start = System.nanoTime();
methodToBeTimed();
long elapsedTime = System.nanoTime() - start;
There is any ... |
It's my first time posing a question here. I would like to know which constructor is better in terms of performance for a large xml dom to be written to a ... |
The scheduler that runs as a daemon in JVM to garbage collect objects, can it be monitored with JMX.Do we have some way of telling that these are the objects it ... |
I want to use BigDecimal to represent arbitrary precision numbers like prices and amounts in a low-latency trading application with thousands of orders and execution reports per second.
I won't be ... |
What are your "Symantec Endpoint" configuration recommendations for a developer PC? We do java development with Eclipse, IntelliJ, Ant and Tomcat. With "Symantec Endpoint" the build and server startup are quite ... |
I have a file which has a many random integers(around a million) each seperated by a white space. I need to find the top 10 most frequently occurring numbers in that ... |
I am supporting a Java messaging application that requires low latency (< 300 microseconds processing each message). However, our profiling shows that the Sun Java Virtual Machine runs slowly at first, ... |
If I want to become a Performance Consultant for Java applications and systems, what are the main skills I need?
- long experience with Java itself
- using a Profiler (or StackShots)
- database knowledge (to avoid/detect ...
|
I made the observation that my java application is running much faster when executed on an AMD processor in contrast to an Intel CPU.
For example my JBoss starts in about 30 ... |
In another SO question I asked why my java programs run faster on AMD than on Intel machines. But it seems that I'm the only one who has observed this.
Now ... |
a) for(int i = 100000; i > 0; i--) {}
b) for(int i = 1; i < 100001; i++) {}
The answer is there on this website (question 3). I just ... |
How would I determine the current server load? Do I need to use JMX here to get the cpu time, or is there another way to determine that or something ... |
I am using a ResourceBundle and Locale to lookup property values. Quite simply, the code looks like this:
public static String getPropertyValue(Locale locale, String resourceName, String key) {
...
|
Can anyone explain the science behind the sampling functionality of visualvm ?
I would have thought that collecting the amount of CPU spent on each particular method would require instrumenting ... |
I found one method in Long class
public static long reverse(long i) {..}
What is the use of this method?
|
Is there a performance penalty for calling getSerializedSize() on a GPB message before serializing the message with writeTo(OutputStream)?
I need to be able to know the size of a message before writing ... |
In analyzing Java GC behavior, some tools has the metric "garbage collection rate" (an example would be in figure 19. from http://www.ibm.com/developerworks/java/library/j-ibmtools2/#fig19) of which the unit is MB/sec.
It's a ... |
we are currently establishing fitnesse as the testing tool user acceptance testing. so far everything is good. we are using the java version "20091121". we are having troubles with folders that ... |
We have a low latency trading system (feed handlers, analytics, order entry) written in Java. It uses TCP and UDP extensively, it does not use Infiniband or other non-standard networking.
Can ... |
I've a Servlet filter which performs the following type cast:
HttpServletRequest httpRequest = (HttpServletRequest) req;
At present my filter is responsible for two tasks that would be better separated into two filters. If ... |
I am looking for a library (or a combination of libraries) to build a java distributed system, made of several applications exchanging data through several pairwise connections (no mapreduce). For the ... |
Logically, if(!foo) and if(foo == false) are equivalent. How are they represented in Java? Is there any difference between the two after compilation, either in the bytecode or in ... |
I'm noticing terrible speeds when trying to use CGLIB with a callback filter (on tens of thousands of objects) but I'm unable to find any information about optimizing CGLIB.
For a search/list ... |
I'm trying to solve Problem 41of project Euler in Java, by counting the number from 99888888 to 80000000(which took very long time :( ), I got 98765431 as ... |
I'm working at a small office,I have an application,it's generate a big text file with 14000 lines;
after each generate i must filter it and it's really boring;
I wanna write an application ... |
Ok, this is not trolling. It's a real, technical question.
Java has the reputation of being slow. There are jokes about it. I am not a great java user, the ... |
Would there be any performance differences between these two chunks?
public void doSomething(Supertype input)
{
Subtype foo = (Subtype)input;
foo.methodA();
foo.methodB();
}
vs.
public void doSomething(Supertype input)
{
...
|
Is there any overhead when we cast objects of one type to another? Or the compiler just resolves everything and there is no cost at run time?
Is this a general things, ... |
I have a standard deck of cards and then have removed a few, from the remaining cards I want to calculate all of the possible two card combinations. For example with ... |
I have the following method:
private static final int OPEN_FOR_RAISE_RANGE = 35;
private static final int OPEN_FOR_CALL_RANGE = 25;
public void foo(double num){
if(num <= OPEN_FOR_RAISE_RANGE){
...
|
Inspired by this question,
Now visible only for users with > 10k rep
I came up with the following code:
$cat loop.c
int main( int argc, char ** argv ) ...
|
I want to store permissions in a bit set to compare them efficiently in Java. A 1 would mean permission granted and 0 permission denied. If the authorization is performed the ... |
This is the output after running for around 10 minutes.
Heap
PSYoungGen total 7040K, used 0K [0x24060000, 0x247c0000, 0x26790000)
eden space 6528K, 0% used [0x24060000,0x24060000,0x246c0000)
...
|
I have a list of constants and want to check if a value passed to a method equals one of the constants. I know Enums which would be fine, but I ... |
My Question is regarding performance of Java versus compiled code, for example C++/fortran/assembly in high-performance numerical applications.
I know this is contentious topic, but I am looking for specific answers/examples. Also ... |
i read that JVM stores internally short, integer and long as 4 bytes. this was an article from year 2000 so i don't know how true it is now.
for the newer ... |
I wrote two methods to check there performance
public class Test1 {
private String value;
public void notNull(){
if( value != null) {
//do something
}
}
public ...
|
I need to write a MultiThreaded Java Application that will be used to load test the MMS Server. Transactions starts when the MMS server indicates to my MultiThreaded Java Application that ... |
Coding i came around to check for the vararg performance of Java.
I write following test code:
public class T {
public static void main(String[] args) {
...
|
Occasionally , we have to write methods that receive many many arguments , for example :
public void doSomething(Object objA , Object objectB ,Date date1 ,Date date2 ,String str1 ,String str2 )
{
}
When ... |
Does obfuscating a Java program affect its performance (excluding renaming things)?
|
HI..I made a little game.But this game works on every computer with different speed.I think it is about resolution.I used every thing in paintcomponent.and If I change screen size the game ... |
I'm doing a simple grid which each square is highlighted by the cursor:
They are a couple of JPanels, mapgrid and overlay inside a JLayeredPane, with mapgrid on the ... |
I am about to use VTD-XML (found at http://vtd-xml.sourceforge.net/) but I am interested in getting real-case usage feedback, by any one that has used the library and has any ... |
Is there ever reason to think the >> (signed) and >>> (unsigned) right bit-shift operators in Java would perform differently? I can't detect any difference on my machine.
This is purely ... |
My java application functionality is to provide reference data (basically loads lots of data from xml files into hashmap) and hence we request for one such data from the hashmap based ... |
I need to make a copy of a given date 100s of times (I cannot pass-by-reference). I am wondering which of the below two are better options
newTime=Calendar.getInstance().setTime(originalDate);
OR
newTime=originalDate.clone();
Performance is of main conern ... |
The title is hardly understandable, but I'm not sure how to summarize that another way. Any edit to clarify is welcome.
I have been told, and recommended to use interfaces to improve ... |
I have some enterprise apps running on Java 1.4. They mostly invoke Stored Procedures on a DB, Parse XML files (at the most few megs large), read and write from and ... |
Is it slower to iterate through a list in Java like this:
for (int i=0;i<list.size();i++) {
.. list.get(i)
}
as opposed to:
for (Object o: list) {
... ...
|
I'm getting twice the frame rate with the earlier Java 6 u 3, than with the new ones. Very weird. Can anyone give some explanation?
On Core 2 Duo 1.83ghz, integrated video ... |
I've got a question related to java performance and method execution.
In my app there are a lot of place where I have to validate some parameter, so I've written a Validator ... |
Right now I'm thinking about adding a private constructor to a class that only holds some String constants.
public class MyStrings {
// I want to add this:
private MyString() ...
|
How to Improve performance of this chunk of code :
public static String concatStrings(Vector strings) {
String returnValue = "";
Iterator iter = strings.iterator();
...
|
I'm puzzled with this.
In my machine
- Direct calculation: 375 ms
- Method calculation: 3594 ms, about TEN times SLOWER
- If I place the method calulation BEFORE the direct calculation, both times are SIMILAR.
Woud you ... |
Effective Java says :
There is a severe performance penalty for using finalizers.
Why is it slower to destroy an object using the finalizers?
|
Public class Example {
private int number;
public Example(int number){
this.number = number;
}
...
|
I have a jvm server in my machine, now I want to have 2 apservers of mine sitting in same machine, however I want the standby one to have a really ... |
I'm asked to shorten the start-up period of a long starting app, however I have also to obligate to my managers to the amount of time i will reduce the startup ... |
I'm doing some audio processing with float. The result needs to be converted back to PCM samples, and I noticed that the cast from float to int is surprisingly expensive.
Whats furthermore ... |
we have a PHP webapp that calls a java binary to produce a pdf report (with jasperreport), the java binary outpus pdf to standart output and exits, the php then send ... |
I have a web service in Java, contained in Jetty. I'm using Sun's Java 6 with the default ParallelGC, and I have the following command-line options turned on: "-verbose:gc -XX:+PrintGCTimeStamps --XX:+PrintGCDetails".
When ... |
Can anyone recommend a web site that includes up to date performance tips for Java? Most of the sites I have found seem to be old and I guess the newer ... |
My app is allocating a ton of objects (>1mln per second; most objects are byte arrays of size ~80-100 and strings of the same size) and I think it might be ... |
I'm creating an application that will tell a user how far away a large number of points are from their current position.
Each point has a longitude and latitude.
I've read over this ... |
I would like to avoid reflection in an open source project I am developing. Here I have classes like the following.
public class PurchaseOrder {
@Property
private Customer ...
|
Is there any difference in efficiency (e.g. execution time, code size, etc.) between these two ways of doing things?
Below are contrived examples that create objects and do nothing, but my actual ... |
I have this results from a speed test I wrote in Java:
Java
real 0m20.626s
user 0m20.257s
sys ...
|