Quick question: will StringTable getting explode?
by Huan Li · in Torque 3D Professional · 06/14/2009 (11:17 pm) · 7 replies
Many occurrence of StringTable->insert() and seems too often.
So will it getting explode? especially in a mmo game, where strings can hardly be well controlled
So will it getting explode? especially in a mmo game, where strings can hardly be well controlled
#2
ArrayObject has been included as a build-in feature in Beta 2, it uses StringTable->insert() to store keys and values, and we used it heavily in our project, I think it's time to fix it up!
06/15/2009 (1:11 am)
@Tom, Thank you very much for the clarification.ArrayObject has been included as a build-in feature in Beta 2, it uses StringTable->insert() to store keys and values, and we used it heavily in our project, I think it's time to fix it up!
#3
06/15/2009 (6:18 am)
Are there any implementation differences in the T3D String class and a std::string?
#4
To your question, i didn't find anything different between the two.
06/15/2009 (6:47 am)
@Manoel, String in StringTable are const char* and typedef-ed by StringTableEntry, it has nothing to do with T3D String class or std::string class.To your question, i didn't find anything different between the two.
#5
If i understand the history right String was originally designed as a replacement for StringTable. Meaning the first implementation hashed and cached all strings into a global table.
The issue there was that using String to do temporary string concatinations and other misc work was extremely slow as it hashed and inserted every intermediate value into the global table. It also caused havoc with threading as we needed them to safely work from other threads.
We've since removed that global table functionality and it is what you see now.
It has many functions which mimic std::string, but i don't think it was designed to match its behavior exactly.
We have discussed internally that at some point we'll have an SharedString class as well as a NetString class which will behave like String, but provide the same functionality as StringTable and NetStringTable.
06/15/2009 (1:58 pm)
@ManoelIf i understand the history right String was originally designed as a replacement for StringTable. Meaning the first implementation hashed and cached all strings into a global table.
The issue there was that using String to do temporary string concatinations and other misc work was extremely slow as it hashed and inserted every intermediate value into the global table. It also caused havoc with threading as we needed them to safely work from other threads.
We've since removed that global table functionality and it is what you see now.
It has many functions which mimic std::string, but i don't think it was designed to match its behavior exactly.
We have discussed internally that at some point we'll have an SharedString class as well as a NetString class which will behave like String, but provide the same functionality as StringTable and NetStringTable.
#6
06/15/2009 (1:59 pm)
@Huan - I'll take a look at ArrayObject and see if it can be converted to String.
#7
06/15/2009 (9:53 pm)
Good News, hope can see the changes in Beta3. Thanks Tom!
Associate Tom Spilman
Sickhead Games
As you can see in new code you see the String class being used over a StringTable StringTableEntry string.
I believe none of the text edit boxes used in chats and such use the StringTable... which is where you would get hit with a ton of unique strings bloating up the StringTable.
Eventually the StringTable will be phased out... but not for this release of Torque 3D. So just be smart about when you use it and when you don't.