[haiku-bugs] [Haiku] #16336: BMenu::RemoveItem have linear time complexity on total item count

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Thu, 02 Jul 2020 04:34:36 -0000

#16336: BMenu::RemoveItem have linear time complexity on total item count
--------------------------------+-----------------------------
 Reporter:  X512                |       Owner:  nobody
     Type:  bug                 |      Status:  new
 Priority:  normal              |   Milestone:  Unscheduled
Component:  Kits/Interface Kit  |     Version:  R1/Development
 Keywords:                      |  Blocked By:
 Blocking:                      |    Platform:  All
--------------------------------+-----------------------------
 This is hrev54373.

 Observed when running menu scripting tests on StyledEdit. Reverse deletion
 order don't help.

 Related code:
 * [https://git.haiku-os.org/haiku/tree/src/kits/interface/Menu.cpp#n2330
 BMenu::_RemoveItems]
 * [https://git.haiku-os.org/haiku/tree/src/kits/support/List.cpp:182
 BList::RemoveItem]
 * [https://git.haiku-os.org/haiku/tree/src/kits/support/List.cpp:381
 BList::IndexOf]

 Problem can be fixed if `BList::IndexOf` will traverse items in reverse
 order. Something like `BList::ReverseIndexOf` can be introduced.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/16336>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: