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

Optimize rendering of ChatMessage #6069

Merged
merged 5 commits into from
Dec 18, 2023
Merged

Optimize rendering of ChatMessage #6069

merged 5 commits into from
Dec 18, 2023

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Dec 17, 2023

Attempt at improving #6064

%%timeit
pn.chat.ChatMessage('Some content', user='user')

Before:

19.6 ms ± 591 µs per loop (mean ± std. dev. of 7 runs, 10 loops each

After:

10.9 ms ± 138 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

The main performance gains here came from avoiding use of ParamMethod and instead favoring manual watch callbacks.

Note those numbers also already account for the changes in: holoviz/param#893

Without that it goes from:

21.6 ms ± 974 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

to:

11.7 ms ± 280 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Copy link

codecov bot commented Dec 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (208fb7b) 84.63% compared to head (a97358f) 84.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6069      +/-   ##
==========================================
+ Coverage   84.63%   84.64%   +0.01%     
==========================================
  Files         295      295              
  Lines       43977    44003      +26     
==========================================
+ Hits        37219    37246      +27     
+ Misses       6758     6757       -1     
Flag Coverage Δ
ui-tests 40.61% <9.21%> (-0.03%) ⬇️
unitexamples-tests 72.73% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahuang11
Copy link
Contributor

There seems to be some weird indentation after these changes:
image

After removing width 100% - 15px, it's back to normal
image

@ahuang11 ahuang11 self-requested a review December 18, 2023 00:30
@ahuang11
Copy link
Contributor

ahuang11 commented Dec 18, 2023

Some flickering seems to occur again (also I tried to fix the weird indentation, but it crops the heart):

Screen.Recording.2023-12-17.at.4.48.40.PM.mov

On main:

Screen.Recording.2023-12-17.at.4.50.05.PM.mov

@philippjfr philippjfr merged commit cd22c2a into main Dec 18, 2023
13 checks passed
@philippjfr philippjfr deleted the chat_msg_optimize branch December 18, 2023 12:30
philippjfr added a commit that referenced this pull request Dec 18, 2023
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.

None yet

2 participants