mdb_v8 icon indicating copy to clipboard operation
mdb_v8 copied to clipboard

prototype findjsobjects using V8 Map pointers

Open davepacheco opened this issue 10 years ago • 0 comments

Today, findjsobjects classifies objects by enumerating their properties and comparing them:

https://github.com/joyent/mdb_v8/blob/bd88d517408f83f372543afa42f81a8e4c08e21c/src/mdb_v8.c#L4429-L4478 https://github.com/joyent/mdb_v8/blob/bd88d517408f83f372543afa42f81a8e4c08e21c/src/mdb_v8.c#L4157-L4195

I believe that the names of an object's properties are determined entirely by the Map object for that object. That is, if two objects point to the same Map object, then they have the same properties. (The converse is not true: two objects can have the same properties and have different Map objects.)

It would be useful to prototype of a findjsobjects implementation that compares Maps at each step of the way before comparing property names, and if the Map matches the Map of a known group of objects, then skip the property name comparison. One downside is that we may not prune as much garbage, since we identify garbage as we enumerate property values during the scan. But if the performance improvement of findjsobjects is significant, it may be worthwhile. We could even add a separate pruning step, or we could do it lazily when users use "::findjsobjects" on each of the representative objects for the first time.

davepacheco avatar Feb 04 '16 23:02 davepacheco