File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Memory Usage Optimization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Memory Usage Optimization" Watch "Memory Usage Optimization" New topic

Memory Usage Optimization

Manu Ramakrishnan

Joined: Jun 07, 2003
Posts: 10
My application involves building spanning trees. It takes one minute to create trees from 3 MB data. But it takes close to 1.5 hours to create tree for 15 MB data. Is is taking this long because it takes a while to allocate space during new operation? I thought the algorithm is straight forward and I don't see any performance tuning in the algorithm.
I need convincing answers of time taken is because of new object creation only.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

There are two things I can think of that can be the problem (neither of which is object creation)

1) Algorithm - Are you using an algorithm that gets exponentially worse for large data? If so, can you tune it?
2) Memory - Are all 15 megs of data in memory at once? If so, there is a lot of paging going on. You would need to do some sort of tuning of the algorithm to reduce the paging.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I'd bet that it's a problem of the algorithm.

Can you explain what it is doing (and how)?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: Memory Usage Optimization
It's not a secret anymore!