Login | Register  
Latest 20 PostsMinimize
09 Mar 2010 06:23 AM
09 Mar 2010 01:29 AM
08 Mar 2010 09:25 AM
08 Mar 2010 09:16 AM
08 Mar 2010 08:46 AM
08 Mar 2010 08:38 AM
07 Mar 2010 10:57 PM
07 Mar 2010 10:51 PM
07 Mar 2010 06:37 PM
07 Mar 2010 06:05 PM
07 Mar 2010 06:01 PM
07 Mar 2010 05:38 PM
07 Mar 2010 10:57 AM
07 Mar 2010 10:40 AM
07 Mar 2010 10:12 AM
07 Mar 2010 09:56 AM
07 Mar 2010 09:39 AM
07 Mar 2010 06:28 AM
07 Mar 2010 01:17 AM
06 Mar 2010 11:37 PM
ForumsMinimize
Lot of string concatenation
Last Post 29 Dec 2009 01:36 AM byFastalanasa. 5 Replies.
Printer Friendly
Sort:
NextNext
You are not authorized to post a reply.
AuthorMessages
JustinUser is Offline
New Member
New Member
Send Private Message
Posts:15
Avatar

--
24 Dec 2009 04:05 AM  

I realize I'm the FNG here but looking through the code I'm seeing a lot of string1 = "blah" + something + "blah" + something;

I'm not trying to stir up some kind of shitstorm but I've seen that kind of code be a huge resource hog when you start scaling up in concurrent users.  Nothing will bring down a CPU/RAM like C# string manipulation.  I humbly suggest the use of String.Format() instead.  It uses the StringBuilder underneath which does create another Object but overall you use less memory and resource than the + string concat.  It will save memory and I think it makes the code more readable.  Not to mention this makes your application orders of magnitude easier to localize and read strings from a string table location in a resource file.

Just something to think about.

BenUser is Offline
The Uncanny Gecko
New Member
New Member
Send Private Message
Posts:88
Avatar

--
24 Dec 2009 04:13 AM  
Yeah, I have been migrating things to String.Format as I work on sections.
JustinUser is Offline
New Member
New Member
Send Private Message
Posts:15
Avatar

--
24 Dec 2009 04:14 AM  
And to add to my own fire, it localization is NEVER EVER going to happen I suggest using string.Concat instead since it's even faster.
KarakUser is Online
Locutus of WheelMUD
Basic Member
Basic Member
Send Private Message
Posts:320
Avatar

--
24 Dec 2009 05:41 AM  

We discussed localization amongst other things here.  Localization is not, and IMO should not be, on our v1 roadmap.  In summary, my points of note are:

* Proper generic localization of a MUD would be a massive undertaking.

* We need to keep a sane scope to make it through v1.

* We don't have any bilingual team members who are begging to implement this functionality all the way through.  Our stance may certainly change if something like that changes.

* Small loc-friendly changes are fine.  However, anything like pulling the text out of their code context and into separate resource files or whatnot would be quite detrimental at this time.

 

I could definitely get behind moving towards a standard of using string.Format over '+' or string.Concat.

JustinUser is Offline
New Member
New Member
Send Private Message
Posts:15
Avatar

--
24 Dec 2009 05:15 PM  
Karak I completely agree, localization is way beyond scope right now. I prefer string.Format since I'm an old C++ dev but either that or string.Concat is far above + in performance when dealing with strings in C# . I think there is a strong architectural reason to formalize on string.Format for all string concatenation, etc.
FastalanasaUser is Offline
Grumpy Half-Elf
Advanced Member
Advanced Member
Send Private Message
Posts:555
Avatar

--
29 Dec 2009 01:36 AM  
My first language is actually Spanish. English is my second language. I know enough French and Catalonian to get into trouble. I can understand some Portuguese as well. I know that there are a lot of Chinese-speaking people that come here. We'll tackle localization after 1.0.
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2007-2009 by WheelMUD  | Terms Of Use | Privacy Statement
Google Analytics Alternative