Closed amaembo closed 2 years ago
So... you're totally right. I'm puzzled as to why the JDK doesn't do this. Maybe they think it's a very rare occurrence.
I have just committed a fix that implements this idea. If you can build and try it out that would be great. I still have to write the unit tests tho (but the modifications are very simple).
In some scenarios fastutil collections could often be empty. In this case, it's desired to optimize toIntArray(), etc. to avoid allocation of a new array and iterator instantiation. These allocations are visible in our profiles. We can fix this on our side but I think it worth fixing in the library. Something like:
Sorry I'm new to this project and have no idea how to build it on my Windows machine, so I cannot test whether this works.