2
votes
0answers
150 views

How to evaluate JNI approaches with Java and Fortran? [closed]

Right now we've got about 150k lines of Java broken into two major parts. The first contains an implementation of the algorithms we're hoping to redo in Fortran, and the second has a good chunk of GUI ...
-1
votes
1answer
58 views

Huge long addition overhead compared to Native call?

A run a simple test JDK 1.7.0_45 (Windows 7, 64bit): Test 1: long start = System.nanoTime(); for (int i=0; i < 1000000; i++) { System.currentTimeMillis(); } elapsed = ...
17
votes
4answers
574 views

How bad is it calling println() often than concatenating strings together and calling it once?

I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an ...
4
votes
1answer
440 views

In Java, why use bit hacks when non-bitwise technique it is more readable?

Is there any legitimate use for bit manipulation hacks in higher-level languages such as Java? I can see them being useful in speed-sensitive low-level and computation-intensive programs, e.g. ...
25
votes
9answers
2k views

Is template “metaprogramming” in Java a good idea?

There is a source file in a rather large project with several functions that are extremely performance-sensitive (called millions of times per second). In fact, the previous maintainer decided to ...
-2
votes
1answer
98 views

What is the best way to get a method name in runtime?

Here is a little background of my problem: I implemented a singleton logger class which is being called from several projects. I want to log the name of the class as well as the name of the method ...
0
votes
1answer
167 views

Using JDBC to asynchronously read large Oracle table

What strategies can be used to read every row in a large Oracle table, only once, but as fast as possible with JDBC & Java ? Consider that each row has non-trivial amounts of data (30 columns, ...
0
votes
0answers
54 views

Where should I declare variables used in for-loops in Java for maximum efficiency? [duplicate]

I'm talking hypothetically but I'll use an example of what I worked on in a programming class a while ago. There's a better way to actually perform the operation, but that's not the point. An example ...
3
votes
1answer
412 views

Hadoop and Object Reuse, Why?

In Hadoop, objects passed to reducers are reused. This is extremely surprising and hard to track down if you're not expecting it. Furthermore, the original tracker for this "feature" doesn't offer any ...
0
votes
3answers
772 views

Super Fast File Storage Engine

I basically have one big gigantic table (about 1.000.000.000.000 records) in a database with these fields: id, block_id, record id is unique, block_id is not unique, it contains about 10k (max) ...
1
vote
3answers
3k views

C++ Performance vs. Java/C# [closed]

My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native ...
8
votes
5answers
1k views

Why did the team at LMAX use Java and design the architecture to avoid GC at all cost?

Why did the team at LMAX design the LMAX Disruptor in Java but all their design points to minimizing GC use? If one does not want to have GC run then why use a garbage collected language? Their ...
4
votes
3answers
3k views

Quickest way to split a delimited String in Java

I am building a Comparator that provides multi-column sort capability on a delimited String. I am currently using the split method from String class as my preferred choice for splitting the raw String ...
1
vote
1answer
196 views

Will JVisualVM degrade application performance?

I have doubts in JVisual VM profiler tool related to performance. I have requirement to implement a JVM Monitoring tool for my enterpise java application. I have gone through some profiling tools in ...
1
vote
3answers
474 views

Storing a value vs calling reference for repeated use in Java

I have an old habit of avoiding calling references multiple times, both for easier to read/maintain code, and for possible efficiency. But I'm wondering which is more efficient (memory, performance, ...
5
votes
4answers
623 views

Performance related doubt in Java with Hibernate

Suppose in some ORM based project (say Hibernate) I am trying to fetch only few columns rather then the whole Object with may be more than 20 attributes. I am writing HQL like "select attr1, attr2 ...
8
votes
4answers
2k views

Is try-finally expensive

In case of code where you have to do a resource cleanup before exiting a function, is there a major performance difference between these 2 ways of doing it. Cleaning the resource before every return ...
1
vote
2answers
2k views

Is rewriting some Java code to C++ using JNI to improve performance a good idea? [closed]

I've tried rewriting some Java functions in C++ and called them using JNI. I observed that it takes longer time to execute the native C++ functions as compared to Java functions, due to the JNI ...
0
votes
1answer
170 views

Will having ClassA extend ClassB slow down my runtime performance compared to having classC which contains all the members of ClassC?

I have a class with a lot of methods. I would like to group similar methods together in their own class, but all of the methods need to extend another class, ClassC. So I was thinking of having ...
3
votes
2answers
379 views

Methods to identify and resolve memory leaks in the JVM

As the data is migrated via the object level, there has been a slow upwards trend in memory usage. I can see the periodic gc activity, but the memory trend is still going up slowly. I have currently ...
9
votes
3answers
3k views

Java Heap Allocation Faster than C++

I already posted this question on SO and it did ok. It was unfortunately closed though(only needs one vote to reopen) but someone suggested I post it on here as it is a better fit so the following is ...
1
vote
2answers
537 views

Static vs. dynamic memory allocation - lots of constant objects, only small part of them used at runtime

Here are two options: Option 1: enum QuizCategory { CATEGORY_1(new MyCollection<Question>() .add(Question.QUESTION_A) .add(Question.QUESTION_B) ...
-1
votes
1answer
171 views

Banking Applications need Auto save? [closed]

We are developing a banking application. It's internal project of the bank. The application has to capture huge data to process. So auto save is recommended approach to capture? How to perform ...
1
vote
2answers
566 views

Parsing a Log File - Java

Im reading a log file in Java on a Linux box on a continual schedule of 2 minutes looking for certain messages. I store the last offset (RandomAccessFile getFilePointer) and read from it onwards when ...
3
votes
1answer
398 views

Java Logfile Parsing Assistance

I'm writing a log parser that continuously looks for specific patterns and then fires off events to another system when it finds these matches. The firing of the event is time critical to catch errors ...
11
votes
8answers
1k views

Does low latency code sometimes have to be “ugly”?

(This is mainly aimed at those who have specific knowledge of low latency systems, to avoid people just answering with unsubstantiated opinions). Do you feel there is a trade-off between writing ...
8
votes
7answers
1k views

Is Java much harder to “tweak” for performance compared with C/C++?

Does the "magic" of the JVM hinder the influence a programmer has over micro-optimisations in Java? I recently read in C++ sometimes the ordering of the data members can provide optimizations ...
48
votes
10answers
3k views

When does “proper” programming no longer matter?

I've been building an android game in my spare time. It's using the libgdx library so quite a bit of the heavy lifting is done for me. While developing, I carelessly selected datatypes for some ...
-3
votes
2answers
734 views

Java performance of StringBuilder append chains [closed]

In Java, if I am building a significant number of strings, is there any difference in performance in the following two examples? StringBuilder sb = new StringBuilder(); for (int i = 0; i < ...
81
votes
11answers
21k views

What backs up the claim that C++ can be faster than a JVM or CLR with JIT? [closed]

A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM ...
6
votes
1answer
601 views

Is event sourcing ready for prime time? [closed]

Event Sourcing was popularized by LMAX as a means to provide speed, performance scalability, transparent persistence and transparent live mirroring. Before being rebranded as Event Sourcing, this type ...
100
votes
11answers
20k views

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...
10
votes
4answers
7k views

How can I monitor the JVM memory in a proper way?

I'm thinking of how we do JVM memory monitor in a low overhead way in production environment even under busy hour. Suppose I have two tomcat app server in production, load balance set up behind them. ...
14
votes
2answers
10k views

Writing low latency Java [closed]

Are there any Java-specific techniques (things which wouldnt apply to C++) for writing low latency code, in Java? I often see Java low latency roles and they ask for experience writing low latency ...
5
votes
4answers
2k views

JSF for an internet facing, high traffic web application

I, perhaps, made a wrong choice of going with a Component-based Framework like JSF for an internet facing, high traffic web application. Development with JSF has although been easier but what I fear ...
8
votes
2answers
2k views

Eclipse runs my java program 6 times faster… Can I achieve this performance without using it?

I've written a java program that generates all repetitive permutations based on the characters and the length given. When I execute my code in Eclipse, it generates a file with 1,000,000 permutations ...
6
votes
2answers
484 views

Session size management

From what I know, the session information is usually saved on the server. In Java the data is handled as a Map which I guess contains the a String identifier and an object reference which points to a ...
3
votes
2answers
174 views

Where can I find good example of techniques to compact data in-memory? [closed]

I'm writing a Java framework to manipulate a large amount of data in-memory, where many "cells" that are near each other will have the same value. I'm looking for algorithms and/or techniques ...
31
votes
5answers
14k views

Performance of Scala compared to Java

First of all I would like to make it clear that this is not a language-X-versus-language-Y question to determine which is better. I have been using Java for a long time and I intend to keep using it. ...
4
votes
3answers
588 views

Question about a “Benchmark” regarding Java and .NET

To get that out of the way - i am not asking about which platform is faster or try to start a flame war. Question: Why is the .NET version slower 5x in the first test ? The results i got were: .NET ...
54
votes
14answers
9k views

Why would it ever be possible for Java to be faster than C++?

Sometimes Java outperforms C++ in benchmarks. Of course, sometimes C++ outperforms. See the following links: http://keithlea.com/javabench/ ...
18
votes
7answers
1k views

How do I avoid “Developer's Bad Optimization Intuition”?

I saw on a article that put forth this statement: Developers love to optimize code and with good reason. It is so satisfying and fun. But knowing when to optimize is far more important. ...
-3
votes
2answers
749 views

One global HashMap vs. many local HashMaps?

Which is more efficient; which is faster? Trade-offs? Goal is for fast look-ups in a web application. UUIDs are the keys, so global will work. Approx 50 million values. A global cache is ...
1
vote
2answers
236 views

How can I avoid the engineering mistakes of PDT?

As a developer with enough experience to evaluate a tool, I may say that PDT is very huge in size and slow in performance for a PHP IDE. It gets bigger by release and exponentially slower by the size ...
23
votes
4answers
4k views

How to significantly improve Java performance?

The team over at LMAX have a presentation about how they were able to do 100k TPS at less than 1 ms of latency. They have backed up that presentation with a blog, technical paper (PDF) and the ...
2
votes
2answers
418 views

Why profile applications using AOP?

When tuning performance in a web application, I am looking for good and light-weight performance profiling tools to measure the execution time for each method. I know that the easiest profiling method ...
3
votes
2answers
136 views

how do you manage application performance reviews

I have been trying to figure out ways to effectively do performance reviews before an install happens for all releases done by our team. Do you usually make this a part of code review process or do ...
5
votes
1answer
531 views

Books on improving JEE web application performance and responsiveness

Does anyone know of any good books on this topic? I did search on amazon but ones that I found are pretty old publications.