Re: EmptyStream to boost performance

2021-11-13 Thread Dr Heinz M. Kabutz
Hello again, after some excellent feedback, I have changed the EmptyStream implementation to contain state. This means we don't get the object allocation down to zero, but it is very close thanks to escape analysis. The speedup is impressive. For an empty ArrayList, we get the following impro

EmptyStream to boost performance

2021-11-06 Thread Dr Heinz M. Kabutz
Good evening, a couple of months ago a fellow Java Champion told me that he had "banned" streams at his company, or at least discouraged their use. The reason was their high allocation rates with empty collections. With traditional for loops, if the collection is empty, then hardly any object