AhiruSoftwareCompany / coldmirrorapp

A soundboard app with quotes and effects from coldmirror (German YouTuber)
MIT License
9 stars 6 forks source link

Performance: Update search results after submitting a string? #8

Closed dieechtenilente closed 7 years ago

dieechtenilente commented 7 years ago

Maybe, this is too much...

Current Code:

searchField.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
[...]
    @Override
    public boolean onQueryTextChange(String newText) {
      if (newText != "") {
        addQuotesToList(searchField.getQuery().toString());
      }
        return false;
      }
    });
okitec commented 7 years ago

Regarding performance:

Golden rule. Don't optimise. Silver rule. When obviously too slow, measure, don't guess. Data structure before code micro-optimisation. Using more efficient data structures is often far effective than improving a bit of code, unless that piece of code is the absolutely critical bottleneck.

dieechtenilente commented 7 years ago

@okitec Well, it depends on how many quotes are filtered. Right now, its fine, but maybe in the future this will be a problem.

okitec commented 7 years ago

Then fix it when, if at all, the problem appears. Strive for the simplest code unless in dire need.

dieechtenilente commented 7 years ago

Hmm, well - closed for now

okitec commented 7 years ago

Thank you for heeding my advice. :smile: