Results 1 to 3 of 3
- 01-31-2013, 05:55 PM #1Member
- Join Date
- Jan 2013
- Rep Power
How to make java not get stuck while performing String operation
I am working on a compression class. So far, I can get the program to compress 100 bytes to 44 bytes. However, when I increase the block size, or I mean the amount of data in the buffer, it takes java alot longer to finish the program. Even though the program is running on a thread. Java gets stuck, and I have to wait long before it finish the compression task. Not to mention the same thing, hanging over when performing the decompression task.
Let me put it into perspective: (the numbers are from actual code running in a thread):
Let say compressing 100 bytes takes 609 milliseconds. Not bad, barely a second. However, 200 bytes, takes 1.702 seconds + milliseconds. Thats 1.093 seconds + milliseconds more than the previous 100 byte task. Now with 300 bytes takes 3.415 seconds + milliseconds. Thats again, 1.713 seconds, or 62 milliseconds more than previous 200 bytes task. And Lastly, 400 bytes takes 6.757 seconds + milliseconds, thats 3.342 seconds + milliseconds more, or 1.629 seconds + milliseconds more than the previous 300 byte task.
What I am trying to say, is that the task is taking too long to finish. Is there a way to go around this. I know that threads make things concurrent, but even like this is taking too long.
I mean the reason the program is taking so long is because it is performing string operations.
Is there a way to make java perform faster under string operation work load?
Last edited by ElvisMachuca; 01-31-2013 at 05:58 PM.
- 01-31-2013, 05:59 PM #2
Re: How to make java not get stuck while performing String operation
If you want help, I suggest you provide an SSCCE showing the benchmark you want to improve.
- 01-31-2013, 09:58 PM #3
- Join Date
- Sep 2008
- Voorschoten, the Netherlands
- Blog Entries
- Rep Power
- By tripline in forum New To JavaReplies: 1Last Post: 10-30-2011, 01:06 AM
- By sheetalmuskan in forum New To JavaReplies: 10Last Post: 07-12-2011, 12:36 PM
- By Jojomofoman in forum New To JavaReplies: 3Last Post: 01-12-2011, 12:45 AM
- By BlueJ Coder in forum New To JavaReplies: 9Last Post: 10-14-2009, 08:48 PM
- By matpj in forum Java AppletsReplies: 4Last Post: 09-26-2008, 03:40 AM