Your proposed "solution" is hardly a general solution. The winner used a java.util.stream.Stream class which is a standard Java class. The rules (https://www.speedment.com/code-one/) stated that import/main class rows were not counted. But even if they did, they would impact any solution about the same.
It reads from memory, not the database. It is true that querying a database vs. using in-JVM-memory snapshots are not the same. They both have different properties. The case at hand was to analyze immutable data where working with snapshots makes sense. If, on the other hand, the case was to work with data in a highly transactional application, then snapshots make little or no sense.
Speedment uses in-JVM-memory technology so, once the tables are moved into the JVM, streams are served using content and indexes directly from off-heap RAM.
Hi all! Nice to see your engagement. I understand your concern about self-promotion but the contest was open and contestants were free to choose any tool, not just Speedment.
I have contributed to open-source speedment stream ORM for many years and have now added in-JVM-memory acceleration. I am still curious to see if your guys can come up with something better.
Give it a real shoot using whatever you can think of. If you can beat it, I promise to write another article about it. Sounds fair?
NB: Setup code adds about 5 extra lines, similar to other tools.