ios - Benchmarking CoreData and Realm -
how can benchmark coredata , realm?
i've used unit testing , took more time realm database add 100,000 records of data compared coredata (which believe incorrect) , no didn't use inmemory because i'm concerned benchmarks being close reality possible.
so what's proper way benchmark database fetch/add/remove processes? xctest? instruments?
if xctest way, must've been testing wrong. believe realm should outperform coredata in @ least simple databases.
some general benchmarking questions:
- what compiler optimization level building with? building in "release" mode full optimizations best optimization setting closest match real world behavior you're seeing.
- are benchmarking in simulator or on real device? it's critical test on real ios device.
- how close benchmark code reflect real-world usage? synthetic benchmarks misleading unless great care taken reflect how libraries used in reality. example, realm's per-transaction overhead higher core data's because preserves isolation (the "i" in acid: e.g. no faults in realm). writes within transaction faster core data. queries faster in realm, graph traversals. creating lots of small transactions, or few large ones? of impacts performance characteristics.
- are accidentally measuring unrelated code in benchmarks? have ask, you'd surprised @ of benchmark code i've seen spending of time in
nslog
...
finally, xctest , instruments shouldn't drastically affect benchmark comparison in situations. i'd encourage @ instruments though confirm #4.
Comments
Post a Comment