summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_model.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-19 15:44:58 +0000
committerDavid Robillard <d@drobilla.net>2009-10-19 15:44:58 +0000
commit5c1dccaca54b3ef834a0b4a09fc92b3e1b552eac (patch)
tree94fc6cf60106174ed0cebaefc2f67069db60d998 /libs/ardour/midi_model.cc
parenta2c434d5cd6d25dd2aeb05a489aeb9f7b29d4eec (diff)
Use logarithmic search for MidiModel::find_note (used by DiffCommand).
git-svn-id: svn://localhost/ardour2/branches/3.0@5800 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_model.cc')
-rw-r--r--libs/ardour/midi_model.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index eb69a2a906..06beb4fa48 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -719,15 +719,10 @@ MidiModel::get_state()
boost::shared_ptr<Evoral::Note<MidiModel::TimeType> >
MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other)
{
- for (Notes::iterator x = notes().begin(); x != notes().end(); ++x) {
- if (**x == *other) {
- return *x;
+ for (Notes::iterator l = notes().lower_bound(other); (*l)->time() == other->time(); ++l) {
+ if (*l == other) {
+ return *l;
}
-
- /* XXX optimize by using a stored iterator and break out
- when passed start time.
- */
}
-
- return boost::shared_ptr<Evoral::Note<TimeType> > ();
+ return boost::shared_ptr<Evoral::Note<TimeType> >();
}