Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » JDT Debugger Big Slowdown
JDT Debugger Big Slowdown [message #331614] Sun, 14 September 2008 04:39 Go to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
I have java code that takes 6 seconds to run in Eclipse normally and 200
to run in the debugger. The code calls a JRE method a million times and
that method internally throws and catches an exception.

I reproduced this with a quick junit test (code below). When I click
run in Eclipse it takes 3.877 seconds. When I click debug it takes
144.452 seconds.

I am not surprised there is a slowdown, but this is huge! Is this an
overhead caused by JDI, or is it due to the Eclipse debugger? Any ideas
to workaround it? e.g. turn off some feature?

Thanks,
Will

import org.junit.Test;

public class ExceptionDebugTest {

@Test
public void run() {
for (long i = 0; i < 1000000L; i++) {
try {
throw new Exception();
}
catch (Exception e) {

}
}
}
}
Re: JDT Debugger Big Slowdown [message #331616 is a reply to message #331614] Sun, 14 September 2008 06:15 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Make sure you don't have any conditional breakpoints. They can cause
lots of overhead. Clear all of your breakpoints if there is any doubt.
Normally running with debug and no breakpoints is pretty much as fast
as the real thing.

Will Horn wrote:
> I have java code that takes 6 seconds to run in Eclipse normally and 200
> to run in the debugger. The code calls a JRE method a million times and
> that method internally throws and catches an exception.
>
> I reproduced this with a quick junit test (code below). When I click
> run in Eclipse it takes 3.877 seconds. When I click debug it takes
> 144.452 seconds.
>
> I am not surprised there is a slowdown, but this is huge! Is this an
> overhead caused by JDI, or is it due to the Eclipse debugger? Any ideas
> to workaround it? e.g. turn off some feature?
>
> Thanks,
> Will
>
> import org.junit.Test;
>
> public class ExceptionDebugTest {
>
> @Test
> public void run() {
> for (long i = 0; i < 1000000L; i++) {
> try {
> throw new Exception();
> }
> catch (Exception e) {
>
> }
> }
> }
> }


--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Re: JDT Debugger Big Slowdown [message #331623 is a reply to message #331616] Sun, 14 September 2008 20:13 Go to previous messageGo to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
Thanks for the response. Actually I am running in the debugger with no
breakpoints at all. I even tried unchecking everything in the
Java\Debug preference page and still there is the same 30x slowdown.

Francis Upton (News) wrote:
> Make sure you don't have any conditional breakpoints. They can cause
> lots of overhead. Clear all of your breakpoints if there is any doubt.
> Normally running with debug and no breakpoints is pretty much as fast
> as the real thing.
>
> Will Horn wrote:
>> I have java code that takes 6 seconds to run in Eclipse normally and
>> 200 to run in the debugger. The code calls a JRE method a million
>> times and that method internally throws and catches an exception.
>>
>> I reproduced this with a quick junit test (code below). When I click
>> run in Eclipse it takes 3.877 seconds. When I click debug it takes
>> 144.452 seconds.
>>
>> I am not surprised there is a slowdown, but this is huge! Is this an
>> overhead caused by JDI, or is it due to the Eclipse debugger? Any
>> ideas to workaround it? e.g. turn off some feature?
>>
>> Thanks,
>> Will
>>
>> import org.junit.Test;
>>
>> public class ExceptionDebugTest {
>>
>> @Test
>> public void run() {
>> for (long i = 0; i < 1000000L; i++) {
>> try {
>> throw new Exception();
>> }
>> catch (Exception e) {
>> }
>> }
>> }
>> }
>
>
Re: JDT Debugger Big Slowdown [message #331658 is a reply to message #331623] Tue, 16 September 2008 00:00 Go to previous messageGo to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
The same behavior happens in IntelliJ, so I guess this is not caused by JDT.

Will Horn wrote:
> Thanks for the response. Actually I am running in the debugger with no
> breakpoints at all. I even tried unchecking everything in the
> Java\Debug preference page and still there is the same 30x slowdown.
>
> Francis Upton (News) wrote:
>> Make sure you don't have any conditional breakpoints. They can cause
>> lots of overhead. Clear all of your breakpoints if there is any
>> doubt. Normally running with debug and no breakpoints is pretty much
>> as fast as the real thing.
>>
>> Will Horn wrote:
>>> I have java code that takes 6 seconds to run in Eclipse normally and
>>> 200 to run in the debugger. The code calls a JRE method a million
>>> times and that method internally throws and catches an exception.
>>>
>>> I reproduced this with a quick junit test (code below). When I click
>>> run in Eclipse it takes 3.877 seconds. When I click debug it takes
>>> 144.452 seconds.
>>>
>>> I am not surprised there is a slowdown, but this is huge! Is this an
>>> overhead caused by JDI, or is it due to the Eclipse debugger? Any
>>> ideas to workaround it? e.g. turn off some feature?
>>>
>>> Thanks,
>>> Will
>>>
>>> import org.junit.Test;
>>>
>>> public class ExceptionDebugTest {
>>>
>>> @Test
>>> public void run() {
>>> for (long i = 0; i < 1000000L; i++) {
>>> try {
>>> throw new Exception();
>>> }
>>> catch (Exception e) {
>>> }
>>> }
>>> }
>>> }
>>
>>
Re: JDT Debugger Big Slowdown [message #331661 is a reply to message #331658] Tue, 16 September 2008 00:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Will Horn wrote:
> The same behavior happens in IntelliJ, so I guess this is not caused by
> JDT.
>
> Will Horn wrote:
>> Thanks for the response. Actually I am running in the debugger with
>> no breakpoints at all. I even tried unchecking everything in the
>> Java\Debug preference page and still there is the same 30x slowdown.
>>
>> Francis Upton (News) wrote:
>>> Make sure you don't have any conditional breakpoints. They can cause
>>> lots of overhead. Clear all of your breakpoints if there is any
>>> doubt. Normally running with debug and no breakpoints is pretty much
>>> as fast as the real thing.
>>>
>>> Will Horn wrote:
>>>> I have java code that takes 6 seconds to run in Eclipse normally and
>>>> 200 to run in the debugger. The code calls a JRE method a million
>>>> times and that method internally throws and catches an exception.
>>>>
>>>> I reproduced this with a quick junit test (code below). When I
>>>> click run in Eclipse it takes 3.877 seconds. When I click debug it
>>>> takes 144.452 seconds.
>>>>
>>>> I am not surprised there is a slowdown, but this is huge! Is this an
>>>> overhead caused by JDI, or is it due to the Eclipse debugger? Any
>>>> ideas to workaround it? e.g. turn off some feature?
>>>>
>>>> Thanks,
>>>> Will
>>>>
>>>> import org.junit.Test;
>>>>
>>>> public class ExceptionDebugTest {
>>>>
>>>> @Test
>>>> public void run() {
>>>> for (long i = 0; i < 1000000L; i++) {
>>>> try {
>>>> throw new Exception();
>>>> }
>>>> catch (Exception e) {
>>>> }
>>>> }
>>>> }
>>>> }
>>>
>>>
My guess is that when you aren't running in debug mode, the jit compiler
is kicking in and optimizing out most of your code since it doesn't
actually do anything. When running in debug mode, the jit compiler
isn't kicking in.

Jit side effects are something you have to keep in mind when attempting
to write benchmark code such as this.

See if the following behaves differently:
public void run() {
int exceptionCount = 0;
for (long i = 0; i < 1000000L; i++) {
try {
throw new Exception();
}
catch (Exception e) {
exceptionCount++;
}
}
System.out.println("Caught " + exceptionCount + " exceptions.");
}
Re: JDT Debugger Big Slowdown [message #331663 is a reply to message #331661] Tue, 16 September 2008 01:17 Go to previous message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
David Wegener wrote:
> Will Horn wrote:
>> The same behavior happens in IntelliJ, so I guess this is not caused
>> by JDT.
>>
>> Will Horn wrote:
>>> Thanks for the response. Actually I am running in the debugger with
>>> no breakpoints at all. I even tried unchecking everything in the
>>> Java\Debug preference page and still there is the same 30x slowdown.
>>>
>>> Francis Upton (News) wrote:
>>>> Make sure you don't have any conditional breakpoints. They can
>>>> cause lots of overhead. Clear all of your breakpoints if there is
>>>> any doubt. Normally running with debug and no breakpoints is pretty
>>>> much as fast as the real thing.
>>>>
>>>> Will Horn wrote:
>>>>> I have java code that takes 6 seconds to run in Eclipse normally
>>>>> and 200 to run in the debugger. The code calls a JRE method a
>>>>> million times and that method internally throws and catches an
>>>>> exception.
>>>>>
>>>>> I reproduced this with a quick junit test (code below). When I
>>>>> click run in Eclipse it takes 3.877 seconds. When I click debug it
>>>>> takes 144.452 seconds.
>>>>>
>>>>> I am not surprised there is a slowdown, but this is huge! Is this
>>>>> an overhead caused by JDI, or is it due to the Eclipse debugger?
>>>>> Any ideas to workaround it? e.g. turn off some feature?
>>>>>
>>>>> Thanks,
>>>>> Will
>>>>>
>>>>> import org.junit.Test;
>>>>>
>>>>> public class ExceptionDebugTest {
>>>>>
>>>>> @Test
>>>>> public void run() {
>>>>> for (long i = 0; i < 1000000L; i++) {
>>>>> try {
>>>>> throw new Exception();
>>>>> }
>>>>> catch (Exception e) {
>>>>> }
>>>>> }
>>>>> }
>>>>> }
>>>>
>>>>
> My guess is that when you aren't running in debug mode, the jit compiler
> is kicking in and optimizing out most of your code since it doesn't
> actually do anything. When running in debug mode, the jit compiler
> isn't kicking in.
>
> Jit side effects are something you have to keep in mind when attempting
> to write benchmark code such as this.
>
> See if the following behaves differently:
> public void run() {
> int exceptionCount = 0;
> for (long i = 0; i < 1000000L; i++) {
> try {
> throw new Exception();
> }
> catch (Exception e) {
> exceptionCount++;
> }
> }
> System.out.println("Caught " + exceptionCount + " exceptions.");
> }

Thanks for the idea, and good point about the JIT compiler. But I
tested your code and still see the same behavior. Even just running

java -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n Foo

has the slowdown.
Previous Topic:Configuration APIs
Next Topic:Multiple eclipse version support.
Goto Forum:
  


Current Time: Sat Jul 20 23:34:46 GMT 2024

Powered by FUDForum. Page generated in 0.04945 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top