Open gabbard opened 4 years ago
@gabbard I think it would make sense to implement this for patterns first and re-profile before implementing it for perception graphs. Is that right?
This may be useful for considerations in #1030’s patterns creation.
When matching patterns, we first sort the perception and pattern graphs so nodes appear in a controlled order which is tuned to optimize matching speed. Profiling indicates this consumes ~5% of total runtime for our verb subset learner tests (one of our most time-consuming test suites).
Here is the relevant code::
Fixing this for patterns is fairly easy: we should sort patterns on creation, via a
converter
in the constructor. Since the same patterns are matched over and over and over, this is a win.It's less obvious to me that enforcing sorting on create for
PerceptionGraph
s will be a net win, but it's worth experimenting with. Part of the problem is that it conflicts somewhat with out goal of minimizing copies. A possible option is:is_sorted
toPerceptionGraph
PerceptionGraph
s for final versions of scenes (after all translation is done)