-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Virtualized traced results list #337
Conversation
e1bec4b
to
2afa65e
Compare
@rubenvp8510 @tiffon Realise this is marked WIP, but just wanted to check if there is any chance this could make it into 1.11, or would it be best to leave for a patch release? |
@objectiser This is almost ready, I need to make sure that one of the test pass, then I can remove the WIP. I think I can have this by tomorrow end of the day, but I need @tiffon feedback. |
That would be great, if you also could cut 1.1.1 release of UI it would be awesome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Great thinking to virtualize the search results!
I ran into an issue with the layout where result items weren't positioned correctly:
(Note: I made the text transparent.)
Taking a step back, we're using ListView
to add virtualized scrolling to the TraceTimelineViewer
. Seems to make sense to stick with ListView
to add virtualized scrolling to the search results, so we don't introduce a second solution for the same functionality in the application code. (We're currently using react-virtualized-select
, so react-virtualized
is already an indirect dependency, but we're not using it in any application code.)
What do you think?
Also, seems like a test is broken. |
437e7dd
to
f19f71c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! A couple of small comments.
> | ||
{name} ({count}) | ||
</Tag> | ||
</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, the <Tag...>
seems pretty heavy. What about using something home-grown?
<li
key={name}
className="ResultItem--serviceTag"
style={{ borderLeftColor: colorGenerator.getColorByKey(name) }}
>
{name} <span className="ResultItem--serviceCount">{count}</span>
</li>
.ResultItem--serviceTag {
background: #fff;
border-left: 15px solid transparent;
border-radius: 4px;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
color: rgba(0, 0, 0, 0.65);
display: inline-block;
font-size: 0.9em;
line-height: 1;
margin: 0.3em 0.35em;
padding: 0.3em;
}
.ResultItem--serviceCount {
font-size: 0.9em;
opacity: 0.5;
padding-left: 0.2em;
}
</ul> | ||
<ListView | ||
dataLength={this.props.traces.length} | ||
itemHeightGetter={() => 155} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to have the initialDraw
prop set, otherwise it will render 300 items, initially.
const { queryOfResults, diffCohort } = this.props; | ||
const searchUrl = getUrl(stripEmbeddedState(queryOfResults)); | ||
const cohortIds = new Set(diffCohort.map(datum => datum.id)); | ||
this.state = { searchUrl, cohortIds }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this state is not being updated when new props come in, so selecting result items for comparison is not working.
Seems like using memoize-one, instead, would be less work than maintaining the state.
69a909f
to
ccafc6f
Compare
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
==========================================
+ Coverage 90.69% 90.73% +0.03%
==========================================
Files 152 152
Lines 3290 3301 +11
Branches 666 667 +1
==========================================
+ Hits 2984 2995 +11
Misses 251 251
Partials 55 55
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks great. But, in using it, it seems pretty choppy, not nearly as smooth as simply rendering all of the result items.
To explore where we might be able to gain some ground, I haphazardly made the following changes:
In ListView/index
- Calling
.forceUpdate()
throughwindow.requestAnimationFrame(..)
, only
In ResultItem
- Replacing all
Link
,Row
,Col
,Tag
with native HTML elements
For the search results, in the React annotations of the timings section in the Chrome dev tools profiler, the update cycle is comprised of:
- Reconciliation 1
- Update
- Reconciliation 2
Totals durations for a single update are:
- Current: ~322ms
- With changes: ~167ms
In the current version, Reconciliation 2 happens synchronously after the update. With the window.requestAnimationFrame(..)
change, there is a gap between them, during which the UI can still scroll (is not frozen), and it feels a lot smoother.
I tested it out with a result set size of around 400 traces which, in total, had ~32k spans.
37f2f7a
to
b39f390
Compare
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
37755ac
to
fb9aaf9
Compare
Which problem is this PR solving?
Short description of the changes