Login | Register  
Latest 20 PostsMinimize
04 Sep 2010 05:25 PM
28 Aug 2010 08:51 PM
RE: MONO - Fastalanasa
28 Aug 2010 01:51 AM
RE: MONO - Taliesen
28 Aug 2010 01:31 AM
RE: MONO - Fastalanasa
27 Aug 2010 04:10 PM
RE: MONO - Taliesen
27 Aug 2010 03:16 PM
RE: MONO - Fastalanasa
27 Aug 2010 09:26 AM
RE: MONO - Karak
27 Aug 2010 05:04 AM
RE: MONO - Taliesen
25 Aug 2010 04:00 PM
RE: MONO - Fastalanasa
25 Aug 2010 04:49 AM
RE: MONO - Taliesen
23 Aug 2010 04:19 AM
RE: MONO - Fastalanasa
23 Aug 2010 02:57 AM
23 Aug 2010 02:54 AM
RE: MONO - Taliesen
23 Aug 2010 02:52 AM
RE: MONO - Fastalanasa
23 Aug 2010 02:36 AM
RE: MONO - Fastalanasa
23 Aug 2010 02:13 AM
RE: Stat System - Fastalanasa
23 Aug 2010 01:57 AM
23 Aug 2010 01:34 AM
23 Aug 2010 01:32 AM
23 Aug 2010 01:30 AM
ForumsMinimize
Lot of string concatenation
Last Post 29 Dec 2009 01:36 AM byFastalanasa. 5 Replies.
Printer Friendly
Sort:
PrevPrev 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 Offline
Locutus of WheelMUD
Advanced Member
Advanced Member
Send Private Message
Posts:501
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:705
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.2
Copyright 2007-2010 by WheelMUD  | Terms Of Use | Privacy Statement
Google Analytics Alternative