Skip to content
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

Use lowerbound in TimeScale timeToIndex search #879

Merged
merged 7 commits into from
Nov 8, 2021

Conversation

edew
Copy link
Contributor

@edew edew commented Nov 2, 2021

Type of PR: enhancement

PR checklist:

Overview of change:

Use the existing lowerbound algorithm to reduce the amount of work done in _recalculateMarkers.

Profiling on my machine shows a reduction in execution time of _recalculateMarkers for the series update case shown here #767 (comment) from ~580ms to ~3ms. In practice this means that the chart remains responsive while recalculating the 12660 markers in the example.

src/model/series.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@timocov timocov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@edew edew changed the title Optimise recalculating nearest time point index for markers Use lowerbound in TimeScale timeToIndex search Nov 8, 2021
@edew edew requested a review from timocov November 8, 2021 11:00
@timocov timocov merged commit f96a6af into tradingview:master Nov 8, 2021
@edew edew deleted the 767-chart-update-lag branch November 8, 2021 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chart with a lot of markers lags when chart.update of a single candle is called
2 participants