Project

General

Profile

Actions

Feature #7666

closed

Consider reducing jsScrollVisibilityChanged_ connections to reduce memory and cpu usage

Added by Bruce Toll about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
07/27/2020
Due date:
% Done:

0%

Estimated time:

Description

As of github wt 4.4.0-rc1-1-gea5f938d, the WWebWidget::OtherImpl constructor initializes and connects a JSignal (jsScrollVisibilityChanged_) to support the ScrollVisibilityChanged feature. This occurs whether the feature is enabled or not.

Attached, for your review, is a patch that replaces jsScrollVisibilityChanged_ with a std::unique_ptr and defers the initialization/connection to first use. I did some light testing with the scrollvisibility feature example and another application which uses this feature and both seem OK.

In addition, I have attached a small test program that can be used for further testing and benchmarking. The program displays a WLineEdit with a WSuggestionPopup populated with 1000 suggestions and reports on the number of exposed signals. Benchmarking a release build of the test program resulted in around a 20% reduction in memory usage (peak "useful-heap" measured with massif) and around a 10% reduction in instructions (measured with callgrind). The test procedure was to start the server and then open 10 firefox sessions at 2 second intervals. The benchmark results are quite rough and would likely vary in subsequent trials; they may also reflect a best case scenario for the patch. The testing was done as a sanity check to confirm the patch was working as intended.

Given the targeted testing, it is possible that I missed the reason for the early construction/connection of the JSignal. If so, or if you have suggestions for improving the patch, please let me know.


Files

Actions #1

Updated by Roel Standaert about 4 years ago

  • Target version set to 4.5.0
Actions #2

Updated by Roel Standaert about 4 years ago

  • Status changed from New to Resolved

Ok, I applied your patch, thanks.

Actions #3

Updated by Roel Standaert almost 4 years ago

  • Description updated (diff)
  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF