4 ms·
> ...as well as increasing the Node.js heap size to 32Gb. > ...also saw that the process’s heap size stayed fairly constant at around 1.2 Gb. This is because
by vkjv 12y ago
> ...as well as increasing the Node.js heap size to 32Gb.
> ...also saw that the process’s heap size stayed fairly constant at around 1.2 Gb.
This is because 1.2 GB is the max allowed heap size in v8. Increasing beyond this value has no effect.
> ...It’s unclear why Express.js chose not to use a constant time data structure like a map to store its handlers.
It it is non-trivial (not possible?) to do this in O(1) for routes that use matching / wildcards, etc. This optimization would only be possible for simple routes.
- quarterto 12y agoThere are ways around that: http://blog.caustik.com/2012/04/11/escape-the-1-4gb-v8-heap-limit-in-node-js/ http://blog.caustik.com/2012/04/11/escape-the-1-4gb-v8-heap-...
- herge 12y ago> It it is non-trivial (not possible?) to do this in O(1) for routes that use matching / wildcards I'd be impressed if they did it consistently in O(1) for static routes. I think they were looking for O(log(number of different routes)) instead of O(n).
- azinman2 12y agoIf the paths have some kind of non crazy Regex leading up to what gets munched for path variables (eg /path1 versus /path2) then you could at least build a tree of maps at each level, which would be roughly constant time for the most common cases.
- herge 12y ago> roughly constant time for the most common cases. For small values of n ;) A tree of maps would be consistently log(n), like any map. Even a hashtable would hash to buckets eventually, and are log(n).
- TheLoneWolfling 12y agoNot if you're using a Cuckoo hashmap. Honestly, I have no idea why people aren't taught Cuckoo-maps by default. It's simple, has true O(1) worst-case lookup, and has easy deletion. About the only problem is trying to prove insertion time.
- tedchs 12y agoThat seems like a pretty low size to me... how are people getting around this when they need to handle >1.2GB of data on Node?
- jonny_eh 12y agoNative code modules I assume.
- deleted 12y ago[deleted]