Changes between Version 2 and Version 3 of Ticket #2179, comment 30


Ignore:
Timestamp:
Oct 19, 2014, 10:53:20 PM (10 years ago)
Author:
Radagast

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2179, comment 30

    v2 v3  
    1 Keep it up. Do you think using Sets may improve performance further as Sets not allow duplicates? This way we might save the cost of indexOf() === -1 which is expensive as it is checked within the double loop (=> n*m*m) in GetAllBuildableEntities() in the GuiInterface. Also === check is expensive in comparison to != check (as all bits and type have to be checked for equality while for != we can terminate once we have found one non-equal bit .. anyway, that's lowlevel, no idea if the javascript compiler optimizes this automatically .. but probably not).
     1Keep it up. Do you think using Sets may improve performance further as Sets not allow duplicates (not sure about Javascript set internals but perhaps it's constant time if they simply overwrite a duplicate entry instead of checking for duplicates)?
     2
     3This way we might save the cost of indexOf() === -1 which is expensive as it is checked within the double loop (=> n*m*m) in GetAllBuildableEntities() in the GuiInterface. Also === check is expensive in comparison to != check (as all bits and type have to be checked for equality while for != we can terminate once we have found one non-equal bit .. anyway, that's lowlevel, no idea if the javascript compiler optimizes this automatically .. but probably not).