|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Mon Jun 25, 2012 11:49 am
Lists in pattern and efficiency |
Hi.
Lists in pattern
Let's consider a typical mud problem. Every character has a short description (shortnose curly halfling) for which we want to remember their names. There is a package in library doing it for us - called Character Short Description. It uses the trigger ({@sdesc}) to find these descriptions and highlight them.
Now I am afraid that with 500 characters or more this may cause a serious slowing down. Wouldn't it be better to set the pattern to (%w %w {man|halfling|dwarf|elf|..[12 races here]..}) and just highlight when it matches a description in the variable? I mean there was anyways need to call %db(@sdesc,%1) to find the name.
Measuring efficiency
Lately I am working on speeding up my CMUD. Is there any built in benchmark that could measure the time of matching triggers? If no, what do you think (is it trustworthy etc.) about my idea I used by now:
Code: |
$time=%secs
#read lorem.txt
$time=%secs-$time
#sh $time |
And in lorem.txt I put one thousand lines like
Code: |
#fire Lorem ipsum dolor sit amet augue. Nulla quis wisi. Sed et ultrices posuere.
#fire In hac habitasse platea dictumst. Aenean ligula eget nunc ultrices tortor vehicula neque vitae feugiat tortor lacus sit.
... |
|
|
Last edited by rozdwojeniejazni on Mon Jun 25, 2012 5:51 pm; edited 2 times in total |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Mon Jun 25, 2012 4:00 pm |
If every sDesc ends in the racial noun... but i know some folks like to use odd nouns or put the noun in the middle 'an elfin lass with long blonde hair'.
for the record i had a DB var with over 3000 items in it... it can get a bit slow, but that is where #THREADs come in handy. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Jun 25, 2012 5:01 pm |
Don't know about which would be more efficient, but you can use %secs for a millisecond timer (system uptime, if I recall correctly).
|
|
|
|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Mon Jun 25, 2012 5:50 pm |
Yeah, on my mud all descriptions are standard like this. :) Otherwise this solution wouldn't be possible, I see now.
Thanks for the %secs, I'll update the code up there. |
|
|
|
|
|