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

Improve search performance #3950

Merged
merged 3 commits into from
Apr 13, 2018
Merged

Improve search performance #3950

merged 3 commits into from
Apr 13, 2018

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Apr 12, 2018

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


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 12, 2018
@stefan-kolb
Copy link
Member

Does this swallow event before the delay or does it just execute the search at a later time one by one?

@Siedlerchr
Copy link
Member Author

@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), () -> {
Copy link
Member

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);
Copy link
Member

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
@Siedlerchr Siedlerchr merged commit 68b3797 into master Apr 13, 2018
@Siedlerchr Siedlerchr deleted the improveSearchPerformance branch April 13, 2018 10:19
Siedlerchr added a commit that referenced this pull request Apr 13, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants