Page 2 of 2

Re: Fastest Trigger Types

Posted: Sun Mar 15, 2020 4:45 pm
by Vadi
I'm also wondering if you'll still get 12million trigger-fails with the build in https://github.com/Mudlet/Mudlet/pull/3463 - let me know.

Re: Fastest Trigger Types

Posted: Sun Mar 15, 2020 4:47 pm
by demonnic
So then why don't we just nix exact match? If you put the full line into begin of line type it's the same thing from the user standpoint, but apparently fails much more swiftly.

Re: Fastest Trigger Types

Posted: Mon Mar 16, 2020 5:39 pm
by fordpinto
I am using pre-compiled binaries. Was already thinking to try compiling myself - it's much easier in Linux than any other system I think. Will try to do that as soon as I am done with a mud project I am half way thru on.

At any rate - my main takeaway from this is that while Regex performance is clearly behind, the throughput on it is still extremely high. Even on my ancient machine I do not expect to see a tangible difference until having ~100,000 triggers in use at once. That number is about a factor of 100 higher than what I would expect to ever need, even in my most ambitious dreams. At least at the moment :).

I have used this opportunity to test the MLObj package, and I have thrown it together quickly so it's not suitable for reuse atm. Looks like there is some interest for people to run their own tests, and I do not think it will be too hard to rework it without MLObj. I'll package it as an XML file with just a test alias defined in it.

A more immediate bottleneck would be that strange behavior (I could not create more than 1600 temp triggers for some reason), so the test code I will post could be used to see if it can be reproduced.

Re: Fastest Trigger Types

Posted: Mon Mar 16, 2020 7:29 pm
by fordpinto
I have cleaned up and I am attaching an alias that allows to run tests such as
trigtest regex
trigtest head
trigtest exact

I do not see the 1,600 trigger limit, so this could be something to do with the older machine I ran it on, or with the MLObj library. As configured now, the alias creates 10,000 triggers, and that works fine. I have managed to run it with 100,000 triggers, but it takes a very long time to create/delete them. It also seems to have crashed the script editor window for some reason, so it's an interesting stress test in other ways as well.

The performance on a per-trigger basis is worse in the case of 100,000 triggers (maybe by ~20%?), perhaps because caching becomes less effective.

Another interesting note, I have added feedTrigger()-s to the script in order to finalize trigger deletion, I think it's indicated in the Wiki documentation. However, the extra feedTrigger statements did not seem to initiate trigger deletion, and did not show up on screen either.

Re: Fastest Trigger Types

Posted: Tue Mar 17, 2020 10:18 am
by Vadi
Nice, thanks for sharing! Can you also run the test against the builds I posted to see how the original post stacks up?

Re: Fastest Trigger Types

Posted: Tue Mar 17, 2020 6:06 pm
by fordpinto
The test build posted above gives me roughly same throughput numbers as stock 4.6.1

Re: Fastest Trigger Types

Posted: Wed Mar 18, 2020 5:05 pm
by fordpinto
Just a quick note: I found out why the triggers weren't cleaned out in the test script. I mentioned this above, the triggers are "deleted" but Mudlet finalizes the deletion on the next received line rather that immediately. I added that extra line but it did not work and I did not see why. It's my own fault - I have placed the additional feedTriggers that was supposed to finalize trigger deletion *before* the tests. Just a brain fart. I have moved that statement where it's supposed to be (the .xml is reuploaded with the fix). Doesn't affect the test results, just a more neat and tidy sequence.

Re: Fastest Trigger Types

Posted: Thu Mar 19, 2020 7:19 pm
by SlySven
Also for regular expressions it may help to optimise them - for the raw PCRE library that involves studying them and within the Qt QRegularExpression class making use of the optimize() method...

Re: Fastest Trigger Types

Posted: Fri Mar 20, 2020 11:00 pm
by fordpinto
@SlySven

I am not familiar with Qt, but I have checked the documentation for the QRegularExpression class you mentioned. If it says what I think it says, then all regular expressions are optimized on first use (unless preemptively optimized by calling the optimize() method you also mentioned). So, all regex matches except first are optimized, and it's the performance of the optimized match that matters. The test above is run against 1000 feedTriggers() with 1 of them having extra overhead from the load required to optimize the regex. I quickly redid the test by adding an extra feedTrigger() before the timer is started to remove the optimization overhead from the statistics, and I did not notice much difference.

I think I will try running some more tests with other trigger types as well, but that's more for curiousity. From practical standpoint it seems to me Mudlet has quite a lot of firepower to spare.