Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VERY IMPORTANT PERFORMANCE UPDATE : Decoupled Views from ProfileListener
There was a serious performance issue with large logs. The UI would hang or even OOM. One of the underlying causes was that every view (Flat, Tree, FlameGraph) was a Listener, and they all would be updated when a new Profile was selected. In case of the FlameGraph View, the performance hit is extremely large, and the UI would hang. Now, the views have been decoupled. The ProfileContext containing an ObjectProperty<Profile> is created first, and the different views will bind or unbind their own ObjectProperty<Profile> to that when they are shown or hidden. As a result, the rendition for each view only takes place at the time they are shown, and even then only if the Profile changes. When they are hidden, they no longer react to new Profiles emitted by the back end until such a time as they are shown again.
- Loading branch information
rx
committed
Dec 30, 2016
1 parent
ca05377
commit afea8f5
Showing
11 changed files
with
318 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
...n/java/com/insightfullogic/honest_profiler/ports/javafx/controller/ProfileController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...va/com/insightfullogic/honest_profiler/ports/javafx/controller/ProfileViewController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,54 @@ | |||
package com.insightfullogic.honest_profiler.ports.javafx.controller; | |||
|
|||
import java.util.function.Function; | |||
|
|||
import com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext; | |||
|
|||
import javafx.beans.property.ObjectProperty; | |||
import javafx.beans.property.SimpleObjectProperty; | |||
import javafx.beans.value.ObservableValue; | |||
|
|||
public abstract class ProfileViewController<T> extends AbstractController | |||
{ | |||
|
|||
private ProfileContext profileContext; | |||
|
|||
private ObjectProperty<T> target; | |||
private Function<ProfileContext, ObservableValue<T>> targetExtractor; | |||
|
|||
protected void initialize(Function<ProfileContext, ObservableValue<T>> targetExtractor) | |||
{ | |||
this.targetExtractor = targetExtractor; | |||
target = new SimpleObjectProperty<>(); | |||
target.addListener((property, oldValue, newValue) -> refresh(newValue)); | |||
} | |||
|
|||
protected ProfileContext prContext() | |||
{ | |||
return profileContext; | |||
} | |||
|
|||
public void setProfileContext(ProfileContext profileContext) | |||
{ | |||
this.profileContext = profileContext; | |||
} | |||
|
|||
protected T getTarget() | |||
{ | |||
return target.get(); | |||
} | |||
|
|||
// Activation | |||
|
|||
public void activate() | |||
{ | |||
target.bind(targetExtractor.apply(profileContext)); | |||
} | |||
|
|||
public void deactivate() | |||
{ | |||
target.unbind(); | |||
} | |||
|
|||
protected abstract void refresh(T target); | |||
} |
Oops, something went wrong.