Odd bug, though I have to wonder why your mud is sending such enormous room ids. Surely there aren't actually 2.29354263 × 10^29 unique rooms.
It's not sending them, that's the problem.
For MUDs that don't have room numbers/IDs the mapper is a bit of a problem. I worked around it by using the room description/minimap as a unique identifier, and then hashed that to make it a workable size (10 characters of hash rather than a whole room name/description).
If I where to guess.. I would say that "string" and "text" are handled differently on the basis that some applications may *need* to store big numbers in strings, so it gets funneled through a conversion function some place (it might be treated as a sort of 'variant' type), where "text" really is literally, "as is, don't do anything else to it". But, that is just guessing. Good thing to know to watch out for.
main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
This has been driving me crazy over the last few days, just updated my mapper module to make uids Text rather than String and this has solved the problem.
I had wondered if it was something to do with the first few chars in the uid. However checking my database I found plenty starting 2E##### so was a bit stuck. Of course looking back now all the other uid starting like this were along the lines of 2E25F#### and calculating 2E25 doesnt take anywhere near as long as 2E515665758.
Anyway all sorted now :)
Just need to iron out the other creases in my shadowdale mapper now :P
Amended on Mon 17 Oct 2011 09:48 AM (UTC) by Nick Gammon
Message
This reproduces it:
DROP TABLE IF EXISTS rooms;
DROP TABLE IF EXISTS exits;
CREATE TABLE IF NOT EXISTS rooms (
roomid INTEGER PRIMARY KEY AUTOINCREMENT,
uid TEXT NOT NULL -- unique room ID
);
CREATE TABLE IF NOT EXISTS exits (
exitid INTEGER PRIMARY KEY AUTOINCREMENT,
fromuid STRING NOT NULL -- exit from which room (in rooms table)
);
CREATE INDEX IF NOT EXISTS fromuid_index ON exits (fromuid);
SELECT * FROM exits WHERE fromuid = '2E515665758C87202B281C7FC';
As a work-around, try changing the code that calculates the room hash, from:
-- generate a "room ID" by hashing the room name, description and exits
uid = utils.tohex (utils.md5 (roomname .. roomdesc .. exits_str .. map_str))
to:
-- generate a "room ID" by hashing the room name, description and exits
uid = utils.tohex ("x" .. utils.md5 (roomname .. roomdesc .. exits_str .. map_str))
Of course this will invalidate the current rooms, but if it fixes the speed problems it should be worth it, until I can work out why this is a problem in the first place.
Amended on Mon 17 Oct 2011 08:12 AM (UTC) by Nick Gammon
Message
Right, well some light at the end of the tunnel ...
This alias reproduces the problem:
<alias
enabled="y"
match="^mapper bugtest3$" regexp="y"
send_to="12">
<send>
t=os.time()
for exitrow in db:nrows("SELECT * FROM exits WHERE fromuid = '2E515665758C87202B281C7FC'") do
end -- for each exit
print("Time taken to load bugged exit", os.time()-t, "s")
</send>
</alias>
Now this rules out problems with loading an exit after loading a room. And since that room doesn't have any exits on the database, I concentrated on the room ID 2E515665758C87202B281C7FC.
Strangely, changing it by removing stuff from the end didn't have any effect. But *this* did:
2F515665758C87202B281C7FC
So what is happening?
Well somewhere something is interpreting the ID as a large number, ie.
2e515665758
It must be taking around 3 seconds to find 2 times 10 to the power 515665758.
But why is it doing that? And why doesn't the Sqlite3.exe program do the same? At least this narrows it down.
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.