Level / memdown

In-memory abstract-leveldown store for Node.js and browsers.
MIT License
287 stars 37 forks source link

Question: Max memdown DB size #91

Closed austinfrey closed 7 years ago

austinfrey commented 7 years ago

Is the DB size limited by v8 memory limits or is it limited by RAM on host machine?

vweevers commented 7 years ago

By V8 heap limit; memdown internally is just a tree of regular JS objects.

austinfrey commented 7 years ago

@vweevers thanks for the answer. is there a difference in performance between reading data into and out of the v8 heap than there would be for traditional RAM?

vweevers commented 7 years ago

If you mean compiled and statically typed languages (e.g. C) accessing fixed memory addresses, then yes, that'll be faster than JS.

V8 typically has to do a lot of lookups, JS being a dynamic language, but does its best to cache lookup paths and optimize in other ways. People do sometimes manage to write JS that's faster than C; in some cases V8 can optimize hot code paths better than a compiler can - because it learns.

This is a complex subject though (I'm not qualified to answer), and more about V8 than memdown.

vweevers commented 7 years ago

For a full picture, you also have to take into account event loop latency, garbage collection, rendering (if in browser), etc.

austinfrey commented 7 years ago

thanks for the info, very helpful