#1174 Performance of hasItem on Sets


From comp.lang.rexx (erich.steinboeck@gmail.com): "Recently I've been hit by a large run-time penalty when I was using hasItem() to check for the existence of items in a large Set (~500.000 items).

Checking for the existence of 1.000 items with hasItem() took 20+ seconds.
Checking the same with hasIndex() took less than 0.01 seconds.

While I do understand that in the general case, hasItem() may take longer than hasIndex(): in the case of Set, shouldn't those two methods behave the same?"

Clearly this performance issue is a bug in that the user has every right to expect that both hasIndex and hasItem should perform the same.

It would seem that the fix would be straightforward: add a hasItem method to the .set class containing -

use arg it
return self~hisIndex(it)


Bugs: #1259


  • Gil Barmwater

    Gil Barmwater - 2013-05-19

    It appears a simpler fix would be:

    forward message 'HASINDEX'

  • Rick McGuire

    Rick McGuire - 2013-11-20
    • Group: 4.1.3 --> None
  • Rick McGuire

    Rick McGuire - 2013-11-23
    • Group: None --> v4.2.0
  • Rick McGuire

    Rick McGuire - 2013-11-24
    • status: open --> accepted
    • assigned_to: Rick McGuire
    • Pending work items: none --> doc
  • Rick McGuire

    Rick McGuire - 2013-11-24

    Code committed [r9555]



    Commit: [r9555]

  • Rick McGuire

    Rick McGuire - 2013-11-24
    • Pending work items: doc --> complete
  • Rick McGuire

    Rick McGuire - 2013-11-24
    • status: accepted --> pending
  • Erich

    Erich - 2014-04-15

    Although I can see that there was a fix applied for this issue, I'm still seeing the performance delta between hasItem and hasIndex in 4.2

    Open Object Rexx Version 4.2.0
    Build date: Feb 22 2014
    Addressing Mode: 64

  • Rick McGuire

    Rick McGuire - 2014-04-15
    • status: pending --> closed


Cancel  Add attachments