"The Desktop Window Manager process has exited."
Ok. The hashtable thing ChatGPT recommended wasn't as effective (albeit faster than roaring bitmap) and in fact taught me the hard way that running out of memory on Windows 11 tends to crash the display manager, which wont restart automatically and there is nothing one can do to restart it. 1/10. don't recommend.
Have to proceed with my naive solution.
BTW, that roaring bitmaps is apparently used by serious businesses, which do analytics on trillions of entities (i.e. user clicked this button event at second T), so it is slow, but compresses a terabyte dataset into a 128mb one, allowing to perform otherwise impossible computation on a phone:
https://vikramoberoi.com/posts/using-bitmaps-to-run-interactive-retention-analyses-over-billions-of-events-for-less-than-100-mo/
I think I can implement something comparable by compressing the currently unused bitmaps regions.