|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sat Dec 27, 2008 1:55 pm
Case Senstivity |
Would setting Case Sensitive slow down or speed up one's triggers?
I've looked at several forums by Googling and find conflicting answers. Of course that was just concerning regex, but I was curious if one set all of their triggers to Case Sensitive if it would speed up or slow down matching or rejecting.
Thanks. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 27, 2008 2:24 pm |
Case insensitivity will double the number of tests for plain-text characters, so it depends how many of those you have in your triggers. The simplest way to find out for sure would be to make two triggers, one with the box checked and one without, and do a bunch of tests.
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Sat Dec 27, 2008 2:35 pm |
My feeling has always been that it should speed up matching, for example the common SAY trigger:
Soandso says, "blah blah blah."
If you know that Soandso must always be a proper name (good for some games), ^[A-Z][a-z]+ says, "(.*)" is a much quicker fail on lines that start with lower case--good for a fairly ugly, slow trigger.
But I base this just on my gut feeling, so ymmv. |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sat Dec 27, 2008 2:36 pm |
What do you mean? Sorry I want to be clear here. Checking the box makes it Case Sensitive. Not checking the box is Case Insensitive right? So if the box is NOT checked it doubles the number of tests for plain-text characters?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Dec 27, 2008 6:08 pm |
Having the Case Sensitive box checked is slightly faster when the pattern contains a lot of plain text stuff like, "The quick brown fox jumped over the lazy dog." When the pattern consists entirely of wildcards and ranges such as "\w+ [a-z]{3}" then checking case sensitive only affects the compile speed. This is because \w is converted to a range during compiling, and the full list of valid characters for a range is recorded during the compilation of the pattern. Basically it is a good idea to turn on case sensitivity whenever possible.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sun Dec 28, 2008 3:39 pm |
Well it made a nice improvement in speed. I've optimized every regex and done just about everything I can imagine now. It's running as smooth and quick as can be, except for the display issues of having command line text chop in half room descriptions and stuff.
Thanks for answering my sometimes silly questions. I don't know what Cmud is doing behind the scenes and was solely concentrating on regex. This actually made even more of an improvement. |
|
|
|
|
|