Open wunderb1t opened 1 year ago
Hello, I see this issue was dropped from the milestone, when to expect it? Thank you!
@wunderb1t we'll add it back to our next milestone and see if we can repro and fix.
With #13254, we got a 10x speedup:
Before:
$ node ./benchmarks/get.js
{
"Model loop ms": 2011,
"POJO loop ms": 7
}
After:
$ node ./benchmarks/get.js
{
"Model loop ms": 206,
"POJO loop ms": 8
}
We may be able to improve this more in the future by avoiding the this.$__schema.paths[path]
lookup by passing the schematype in directly, and by passing in noDottedPath
as a primitive rather than relying on options
. However, we are limited in how much we can speed up model property accesses - they will always be significantly slower than a plain old property accesss because we need to support custom getters.
Prerequisites
Last performant version
6.9.0
Slowed down in version
6.9.0
Node.js version
13.14.0
🦥 Performance issue
Suppose we have 1k documents in MongoDB collection and we fetched them all. Then we want to work with all document properties inside loop because we have familiar application structure. The problem is that property getting on Model objects extremely slow comparing with Plain objects.
Here is ours tests output result:
Steps to Reproduce
Expected Behavior
Iteration time should be similar to Plain objects loop time.