Hey Room and Kotlin people :wave: Just a quick q...
# room
m
Hey Room and Kotlin people 👋 Just a quick question. I'm not very familiar with Room yet but I'm reviewing some code. Is the
Room.inMemoryDatabaseBuilder
supposed to be destroyed and recreated again for every test? Like in this example in the documentation https://developer.android.com/training/data-storage/room/testing-db Is it optimized for constant recreation or is the performance hit very small? It looks to me like the db instance could be reused and we just clear everything. Maybe the performance gain is negligible. Thanks!
y
in memory database is specifically targeted at tests so that tests can be isolated from each other. You can as well clear your databases across tests but w/ ongoing connections etc, it would be very easy to leak active work and affect other tests. Is there a reason why you are worried about the performance of it, for your tests? Even though we’ve never measured it, I would expect it to be negligible. Biggest cost for SQLite is Disk IO and there is no disk IO for in memory database; everything else should be negligible