-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve search performance #3950
Conversation
Does this swallow event before the delay or does it just execute the search at a later time one by one? |
@stefan-kolb The timer is resetted when you type new chars |
@@ -186,7 +191,13 @@ public void actionPerformed(ActionEvent e) { | |||
updateSearchModeButtonText(); | |||
searchModeButton.addActionListener(event -> toggleSearchModeAndSearch()); | |||
|
|||
EasyBind.subscribe(searchField.textProperty(), searchText -> performSearch()); | |||
//Add a delay of 400 milliseconds before starting search | |||
Timer searchTask = FxTimer.create(Duration.ofMillis(400), () -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract the search delay as a constant
|
||
@SuppressWarnings("Duplicates") | ||
public class GlobalSearchBar extends JPanel { | ||
|
||
private static final PseudoClass CLASS_NO_RESULTS = PseudoClass.getPseudoClass("emptyResult"); | ||
private static final PseudoClass CLASS_RESULTS_FOUND = PseudoClass.getPseudoClass("emptyResult"); | ||
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalSearchBar.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger should be first attribute in the class
extract constant
* upstream/master: Pdf exporter - delete xmp actions in the menu bar and the cli option (#3947) Improve search performance (#3950) New Crowdin translations (#3949) Update dependencies for junit, mockito and checkstyle (#3951) Add XMP Exporter (#3895) Switch colors of search icon for the two search modes (#3871) # Conflicts: # src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Before executing the search there is now a short delay.
I tested this with the Huge file bib and the performance is way better.
Still the entry editor has a high load, but that's out of scope.
Thx to @halirutan who pointed me to the code in #3553