Performance - Sign Filter



  • hey guys,
    i've got a performance related question.
    i'm working on a config with a username filter.
    i.e. i want to filter usernames that contain certain signs.
    lets say the signs are "@", "-" and "+".
    now i could do this by a few if-statements in loliscript:

    IF "<USER>" Contains "@"
    SET STATUS FAIL
    ENDIF
    IF "<USER>" Contains "-"
    SET STATUS FAIL
    ENDIF
    IF "<USER>" Contains "+"
    SET STATUS FAIL
    ENDIF
    

    or i could do this with a simple keycheck:

    KEYCHECK 
      KEYCHAIN Failure OR 
        KEY "<USER>" Contains "@" 
        KEY "<USER>" Contains "-" 
        KEY "<USER>" Contains "+" 
    

    now the question is: what's the best way of doing this?!
    are they performance-wise the same? is one faster than the other?
    is there a third way that's even better?!


  • Admin

    The debugger has a timer that tells you exactly how much time is required to run a config. You could use that to determine which one is faster.

    Also, for your particular problem, there is indeed a 3rd very fast way: using data rules. You can find rules in Configs -> Other Options -> Data and in your specific case you would set up a rule like this one

    17e8636b-aaff-4f4e-88ef-e9d2dcd995aa-image.png



  • @Ruri
    awesome! thanks a lot! this third way is exactly what i've been looking for.
    concerning the debugger-timer though: isn't that affected by all the output the debugger got to print?!
    so that's why i figured debugger timings and runner timings differ...


  • Admin

    Yes of course but if you just put those lines (instead of a whole config) the printed stuff will basically be the same.


Log in to reply