This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Improve PostingList iterator string representation
ClosedPublic

Authored by kbobyrev on Sep 14 2018, 3:28 AM.

Details

Summary

While dumping the element under PostingList iterator cursor, indicate whether this element is followed by or preceded by any other elements.

Diff Detail

Event Timeline

kbobyrev created this revision.Sep 14 2018, 3:28 AM
ioeric accepted this revision.Sep 17 2018, 12:43 AM
ioeric added inline comments.
clang-tools-extra/clangd/index/dex/Iterator.h
96–97

I'd probably print ... [ID] ... to indicate that there can be other elements in the list.

This revision is now accepted and ready to land.Sep 17 2018, 12:43 AM
kbobyrev updated this revision to Diff 165964.Sep 18 2018, 7:02 AM

@ioeric does this format look better?

ioeric accepted this revision.Sep 18 2018, 7:14 AM
ioeric added inline comments.
clang-tools-extra/clangd/index/dex/PostingList.cpp
66

nit: should we drop the trailing ... if Index is the last element?

kbobyrev updated this revision to Diff 165973.Sep 18 2018, 7:19 AM
kbobyrev marked an inline comment as done.
kbobyrev retitled this revision from [clangd] NFC: Update documentation of Iterator's dump format to [clangd] Improve PostingList iterator string representation.
kbobyrev edited the summary of this revision. (Show Details)
sammccall accepted this revision.Sep 18 2018, 10:05 AM

This change seems fine but...

This representation with the raw DocIDs and position dumped seems mostly useful for debugging buggy iterator implementations, but not really useful for understanding query structure and behavior.

I thought we might be replacing this soon. Of course there's no fundamental reason we can't keep both but I'm curious why this is an area of focus :-)

This change seems fine but...

This representation with the raw DocIDs and position dumped seems mostly useful for debugging buggy iterator implementations, but not really useful for understanding query structure and behavior.

I agree; There is another issue that I was looking into: I think that it might be useful to understand the structure of fuzzy find query when using dexp tool and I thought that it would be great if we could dump the iterator tree structure along with the results (which is an extension of D52233). For dexp usecase, it would be great to dump the size and the origin of each piece of iterator tree (e.g. labels), but I also think that it might be useful to have "debugging" format so I couldn't figure out what's the best approach here.

I thought we might be replacing this soon. Of course there's no fundamental reason we can't keep both but I'm curious why this is an area of focus :-)

Yes, we are. Initially, this wasn't an area of focus: I just forgot to update the comment in Iterator.h when moving PostingList to a separate file and slightly changing the format, but then Eric had a good proposal and I thought that it's a good improvement. Also, even though the implementation will be different, the dumping format could be the same, so it's not really implementation-specific.

kbobyrev closed this revision.Sep 21 2018, 7:39 AM

I think this one is addressed in the VByte patch, so I'm closing this revision in order to prevent conflicts between these two.