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

perf: improved textcell performance for novels #8986

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

ashtonG
Copy link
Contributor

@ashtonG ashtonG commented Mar 12, 2024

Description

This fixes an issue where the glide table performance would chug when given a text cell with lots of text to truncate. while measureText is more performant than getBoundingClientRectangle, it can still be problematic to call excessively. To remedy, we implement a binary search for the longest string that's still below max width, reducing the number of times we need to measure the text for longer texts at the cost of calling it a few more times for shorter texts.
ET-71

Test Plan

  • create several experiments with long descriptions (<1000 characters) in the same project
  • visit the project where you created the experiments in webui
  • ensure the description column is selected in the table settings
  • when the table is showing the created experiments, the ui should remain responsive

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

ET-71

This fixes an issue where the glide table performance would chug when
given a text cell with lots of text to truncate. while `measureText` is
more performant than getBoundingClientRectangle, it can still be
problematic to call excessively. To remedy, we implement a binary search
for the longest string that's still below max width, reducing the number
of times we need to measure the text for longer texts at the cost of
calling it a few more times for shorter texts.
@ashtonG ashtonG requested a review from a team as a code owner March 12, 2024 13:15
@ashtonG ashtonG requested a review from EmilyBonar March 12, 2024 13:15
@cla-bot cla-bot bot added the cla-signed label Mar 12, 2024
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 42.75%. Comparing base (cc2e9b4) to head (7b216f9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8986      +/-   ##
==========================================
- Coverage   47.49%   42.75%   -4.74%     
==========================================
  Files        1168      848     -320     
  Lines      176296   137036   -39260     
  Branches     2352     2352              
==========================================
- Hits        83733    58592   -25141     
+ Misses      92405    78286   -14119     
  Partials      158      158              
Flag Coverage Δ
harness ?
web 42.83% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...es/F_ExpList/glide-table/custom-renderers/utils.ts 10.81% <0.00%> (-0.96%) ⬇️

... and 322 files with indirect coverage changes

Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 7b216f9
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65f0558a3fc81f00089239ff
😎 Deploy Preview https://deploy-preview-8986--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@EmilyBonar EmilyBonar left a comment

Choose a reason for hiding this comment

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

Really nice performance improvement!

@ashtonG ashtonG merged commit 52572d4 into main Mar 13, 2024
76 of 88 checks passed
@ashtonG ashtonG deleted the bug/ET-71/text-cell-performance branch March 13, 2024 14:20
maxrussell pushed a commit that referenced this pull request Mar 21, 2024
This fixes an issue where the glide table performance would chug when
given a text cell with lots of text to truncate. while `measureText` is
more performant than getBoundingClientRectangle, it can still be
problematic to call excessively. To remedy, we implement a binary search
for the longest string that's still below max width, reducing the number
of times we need to measure the text for longer texts at the cost of
calling it a few more times for shorter texts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants