eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
157 stars 125 forks source link

remove recursion from VMInputStream #2816

Open hduelme opened 1 month ago

hduelme commented 1 month ago

What it does

Currently VMInputStream uses recursion to retry reads in the int read() method. I replaced the recursive call with a while loop. This removes unnecessary overhead while running tests.

How to test

This doesn't change any behavior.

Author checklist

stephan-herrmann commented 1 month ago

This removes unnecessary overhead while running tests.

Can you give numbers for this overhead?

hduelme commented 1 month ago

I did some testing. If the build is successful no recursive calls happen. Only if something is written to the errorStream the IOException is thrown. In this case a found between 10 to 500 recursive calls.

stephan-herrmann commented 1 month ago

In this case a found between 10 to 500 recursive calls.

What's wrong with that?

When you said "overhead" I was expecting some time measurements... a recursive call is not overhead per se.

hduelme commented 1 month ago

I agree. I was also expecting different results. I got here in the first place due to a exception with a large stacktrace