#1174 Performance of hasItem on Sets

v4.2.0
closed
Rick McGuire
None
complete
1
2014-04-15
2013-05-13
Gil Barmwater
No

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)

Related

Bugs: #1259

Discussion

  • Rick McGuire
    Rick McGuire
    2013-11-24

    • status: open --> accepted
    • assigned_to: Rick McGuire
    • Pending work items: none --> doc
     
  • 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

     


Anonymous


Cancel   Add attachments