[Lldb-commits] [PATCH] D13902: [DataFormatters] Make libc++ list loop detection linear
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 20 09:47:40 PDT 2015
labath created this revision.
labath added a reviewer: granata.enrico.
labath added subscribers: sivachandra, lldb-commits.
Loop detection code is being called before every element access. Although it tries to cache some
of the data by remembering the loop-free initial segment, every time it needs to increase this
segment, it will start from scratch. For the typical usage pattern, where one accesses the
elements in order, the loop detection will need to be run after every access, resulting in
quadratic behavior. This behavior is noticable even for the default 255 element limit.
In this commit, I rewrite the algorithm to be truly incremental -- it maintains the state of its
loop-detection runners between calls, and reuses them when it needs to check another segment.
This way, each part of the list is scanned only once, resulting in linear behavior.
Also note that I have changed the operator== of ListEntry to do the comparison based on the
value() function (instead of relying on ValueObjectSP equality). In my experiments, I kept
getting different ValueObjectSPs when going through the same element twice.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 11138 bytes
Desc: not available
More information about the lldb-commits