i tried the 1brc challenge in kotlin. the naive implementation was simple enough, though not exactly like the java version - the
groupingBy function works differently, in that it emits a
Grouping instance which then provides
the use of a
Sequence (akin to lazily evaluated java streams) is necessary as a list wouldn't fit in memory. interestingly, kotlin doesn't provide parallel sequence processing (unlike java's
chunking the input into sub-lists for parallel processing isn't possible, as this would lead to the whole file having to be loaded into RAM before chunking (which produces
Sequences). my next step, if i were to follow up on this, would be to divide the file into n regions and let threads build maps for the regions and finally merge the maps.