GraphLib icon indicating copy to clipboard operation
GraphLib copied to clipboard

Move Away From Streams Where Possible

Open Kneelawk opened this issue 2 years ago • 2 comments

The Issue

Java's Streams are slow. Much of the GraphLib API makes use of Streams when returning an immutable reference to a collection.

There are many instances where simply returning an immutable, wrapped collection would be easier and more efficient.

Kneelawk avatar Jun 04 '23 20:06 Kneelawk

Removing Streams from the API is looking less and less doable. It's hard to find another java type that represents this immutable-only kind of interface. Furthermore, many of GraphLib's API operations revolve around mapping, filtering, and flat-mapping. These are all operations that are most cleanly performed on Streams.

I can, however, remove some of the usages of streams from GraphLib's internals.

Kneelawk avatar Jun 05 '23 16:06 Kneelawk

I need to look into this more, and a general removal of Streams from the GraphLib API probably won't be able to make it into the 1.0 release.

Kneelawk avatar Jun 05 '23 16:06 Kneelawk