# A few optimization questions...

Don Schwarz (darkowl@darkowl.pr.mcs.net)
Fri, 3 May 1996 20:42:56 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    On Fri, 3 May 1996, Pavel Curtis wrote:

    > Don Schwarz writes:
    > > Also, is:
    > >   <some large string> in { <a list of about 25 equally large strings> }
    > > faster (and less CPU intensive) than:
    > >   string_hash( <some large string> ) in { <a list of 25 MD5 hashes> }
    > Good god, yes!  All of the MD5 functions are *much* slower than the other
    > simple operations.  Have you *seen* the complexity of that function?!
    Yeah, but for some reason I thought using a list of 25 200 character strings
    would slow things down a lot.  Actually, after taking another look at the
    code, it's a lot slower than I remembered it being.  Too bad there isn't a
    simpler function available for things like this.

    > > And lastly, would it be worthwhile to write a special built-in function for
    > > something that runs approx. 10 times per call to $player:notify, to be used
    > > instead of:
    > >   match(foo, "%[%w%w:[a-zA-Z0-9:_]*%]")[1..2]
    > Gack!  It would be better to simply get rid of the necessity to do this on
    > every :notify.
    Heh, I wish I could, but I don't see any other way to do it.  Actually
    though, it's really not 10 times per call, a lot of the time it will only be
    called once and will fail.  And, by the time I get done with it, it'll only
    be done once for things like $room:announce calls, instead of once for each
    player.  So it's not quite as bad as it sounds, but it's still pretty slow,
    which is why I'd really like to use something other than regexps.
                                                            --Dark_Owl