performance 1 « performance « Java Testing Q&A

Home
Java Testing Q&A
1.Development
2.FindBugs
3.HTMLUnit
4.hudson
5.junit
6.performance
7.plugin
8.profile
9.selenium
10.Tools
11.unit test
Java Testing Q&A » performance » performance 1 

1. Java: Advice on handling large data volumes. (Part Deux)    stackoverflow.com

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 ...

2. Calculate Throughput    stackoverflow.com

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 ...

3. .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])?    stackoverflow.com

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 ...

4. Java2D Performance Issues    stackoverflow.com

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 ...

5. Castor performance issues    stackoverflow.com

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 ...

6. Lookup Op performance    stackoverflow.com

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 ...

7. Is there any performance reason to declare method parameters final in Java?    stackoverflow.com

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 ...

8. Java performance with very large amounts of RAM    stackoverflow.com

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 ...

9. System.currentTimeMillis() vs. new Date() vs. Calendar.getInstance().getTime()    stackoverflow.com

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 ...

10. Java for Audio Processing is it Practical?    stackoverflow.com

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 ...

11. int or Integer    stackoverflow.com

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. ...

12. Java Performance Testing    stackoverflow.com

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 ...

13. JAVA- Function to determine whether a poker hand is a straight?    stackoverflow.com

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 ...

14. How to remove System.out.println's from codebase    stackoverflow.com

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 ...

15. Has anyone found Garbage Collection tuning to be useful?    stackoverflow.com

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 ...

16. Java switch cases: with or without braces?    stackoverflow.com

Consider the following two snippets, with braces:

switch (var)
{
  case FOO:
  {
    x = x + 1;
    break;
  }

  case BAR:
  ...

17. Does XtUnit support performance testing?    stackoverflow.com

Does XtUnit support performance testing?

18. Horrendous Performance in a Simple Java2D App    stackoverflow.com

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 ...

19. Vast difference in Java Performance from 1.4 to 1.6    stackoverflow.com

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? ...

20. Can I compile java myself?    stackoverflow.com

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 ...

21. Using hprof on a running application in Sun Java 5    stackoverflow.com

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 ...

22. Java Realtime Performance    stackoverflow.com

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 ...

23. Efficiency of Java "Double Brace Initialization"?    stackoverflow.com

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");
   ...

24. Java: What's the reason behind System.out.println() being that slow?    stackoverflow.com

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 ...

25. When to Be Specific About the Type of List You Want    stackoverflow.com

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)
    ...

26. Does Java optimize method calls via an interface which has a single implementor marked as final?    stackoverflow.com

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 ...

27. Fastest way to iterate in Java    stackoverflow.com

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 ...

28. White papers and books on programming for performance in Java    stackoverflow.com

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 ...

29. Is there a performance difference between these two pieces of code?    stackoverflow.com

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 ...

30. Java performance Inconsistent    stackoverflow.com

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 ...

31. Speed tradeoff of Java's -Xms and -Xmx options    stackoverflow.com

Given these two commands A:

$ java -Xms10G -Xmx10G myjavacode input.txt
B:
$ java -Xms5G -Xmx5G myjavacode input.txt
I have two questions:
  1. Since command A reserves more memory with its parameters, will A run faster than B? ...

32. What should I look for when improving performance in Java?    stackoverflow.com

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. ...

33. Java performance timing library    stackoverflow.com

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 ...

34. Which constructor is better for StreamResult()?    stackoverflow.com

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 ...

35. Does java garbage scheduler depict it details in some form?    stackoverflow.com

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 ...

36. How using BigDecimal would affect application performance?    stackoverflow.com

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 ...

37. Antivirus (Symantec Endpoint) configuration for developer machine    stackoverflow.com

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 ...

38. Most frequently repeated numbers in a huge list of numbers    stackoverflow.com

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 ...

39. Technique or utility to minimize Java "warm-up" time?    stackoverflow.com

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, ...

40. What are the main Skills to be a Performance Consultant?    stackoverflow.com

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 ...

41. Why is my java application faster on an AMD processor?    stackoverflow.com

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 ...

42. Performance of java on different hardware?    stackoverflow.com

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 ...

43. Which of these pieces of code is faster in Java?    stackoverflow.com

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 ...

44. Java - how to determine the current load    stackoverflow.com

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 ...

45. Java ResourceBundle Performance    stackoverflow.com

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) {
   ...

46. Sampling in visual vm    stackoverflow.com

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 ...

47. what is the use of Long.reverse(long ) method?    stackoverflow.com

I found one method in Long class public static long reverse(long i) {..} What is the use of this method?

48. Performance penalty of getSerializedSize() in Protocol Buffers    stackoverflow.com

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 ...

49. What does "garbage collection rate" mean, and what benefit it could provide?    stackoverflow.com

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 ...

50. Fitnesse framework very slow when folder depth is greater 4 - why?    stackoverflow.com

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 ...

51. Best OS to deploy a low latency Java application?    stackoverflow.com

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 ...

52. Casting performance in Java    stackoverflow.com

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 ...

53. Java framework for distributed system    stackoverflow.com

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 ...

54. What is the performance difference, if any, between if(!foo) and if(foo == false) in Java?    stackoverflow.com

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 ...

55. Slow CGLIB Performance using Callback Filters    stackoverflow.com

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 ...

56. Tips to solve problem #41 of project euler    stackoverflow.com

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 ...

57. How can i filtered with the best performance? (JAVA)    stackoverflow.com

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 ...

58. Why did java have the reputation of being slow?    stackoverflow.com

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 ...

59. Is there any runtime cost for Casting in Java?    stackoverflow.com

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)
{
 ...

60. Does Java casting introduce overhead? Why?    stackoverflow.com

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, ...

61. get every two card combination from subset of standard deck    stackoverflow.com

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 ...

62. Finding the range in which a number lies    stackoverflow.com

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){
      ...

63. Why Java is running faster than C here?    stackoverflow.com

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 ) ...

64. Compare bit sets efficiently    stackoverflow.com

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 ...

65. What is a good gc tuning strategy for gc output that I have?    stackoverflow.com

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)
 ...

66. How to check if a parameter value is in a list of constants    stackoverflow.com

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 ...

67. C/C++ versus Java/C# in high-performance applications    stackoverflow.com

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 ...

68. java short,integer,long performance    stackoverflow.com

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 ...

69. ' ... != null' or 'null != ....' best performance?    stackoverflow.com

I wrote two methods to check there performance

 public class Test1 {

 private String value;

 public void notNull(){
  if( value != null) {
    //do something
  }
}

public ...

70. Load Testing Multithreaded Java Application 1400 TPS Required    stackoverflow.com

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 ...

71. Java's varargs performance    stackoverflow.com

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) {

   ...

72. best practice for passing many arguments to method?    stackoverflow.com

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 ...

73. Does obfuscation affects performance?    stackoverflow.com

Does obfuscating a Java program affect its performance (excluding renaming things)?

74. game speed problem    stackoverflow.com

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 ...

75. Java repaint is slow under certain conditions    stackoverflow.com

I'm doing a simple grid which each square is highlighted by the cursor: alt text They are a couple of JPanels, mapgrid and overlay inside a JLayeredPane, with mapgrid on the ...

76. VTD-XML Parsing Performance (speed critical factor). Requesting Feedback/Comments    stackoverflow.com

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 ...

77. Ever any performance different between Java >> and >>> right shift operators?    stackoverflow.com

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 ...

78. Response Time is different for mulitiple execution of the application with the same request Performance problem    stackoverflow.com

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 ...

79. calendar.getInstance() or calendar.clone()    stackoverflow.com

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 ...

80. In Java, is there a performance gain in using interfaces for complex models?    stackoverflow.com

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 ...

81. Java 1.4 to Java 6 migration    stackoverflow.com

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 ...

82. Performance: Iterating through a List in Java    stackoverflow.com

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) {
    ... ...

83. Drawing performance in Java 6 updates 19,20 versus Java 6 update 3?    stackoverflow.com

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 ...

84. Java performance issue    stackoverflow.com

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 ...

85. Use of private constructor to prevent instantiation of class?    stackoverflow.com

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() ...

86. How can we improve performance of this piece of code?    stackoverflow.com

How to Improve performance of this chunk of code :

public static String concatStrings(Vector strings) {
    String returnValue = "";

    Iterator iter = strings.iterator();
   ...

87. Strange performance behaviour    stackoverflow.com

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 ...

88. Why do finalizers have a "severe performance penalty"?    stackoverflow.com

Effective Java says :

There is a severe performance penalty for using finalizers.
Why is it slower to destroy an object using the finalizers?

89. Java language convention; getters/setters    stackoverflow.com

Public class Example {

    private int number;

    public Example(int number){
        this.number = number;
    }

  ...

90. java increase xmx dynamically at runtime    stackoverflow.com

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 ...

91. I'm asked to tune a long starting app into a short time period    stackoverflow.com

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 ...

92. Performance: float to int cast and clipping result to range    stackoverflow.com

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 ...

93. How can I disable Java garbage collector?    stackoverflow.com

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 ...

94. reasons why GcTimeLimit might not be erroring out?    stackoverflow.com

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 ...

95. Updated resource for java performance tuning    stackoverflow.com

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 ...

96. Does allocation speed depend on the garbage collector being used?    stackoverflow.com

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 ...

97. Java: Calculate distance between a large number of locations and performance    stackoverflow.com

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 ...

98. Improving field get and set performance with ASM or Javassist    stackoverflow.com

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 ...

99. Java anonymous class efficiency implications    stackoverflow.com

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 ...

100. Java JRE vs GCJ    stackoverflow.com

I have this results from a speed test I wrote in Java:

Java

real        0m20.626s
user        0m20.257s
sys    ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.