Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
AnswerRe: MDI Child Pin
Pete O'Hanlon24-Apr-07 3:06
mvePete O'Hanlon24-Apr-07 3:06 
QuestionWebServices and classes Pin
JHubSharp24-Apr-07 2:29
JHubSharp24-Apr-07 2:29 
QuestionSystem.NotSupportedException (not support proxies of web-proxy scheme) Pin
AlexZieg7124-Apr-07 2:26
AlexZieg7124-Apr-07 2:26 
QuestionCOM realted question Pin
Stevo Z24-Apr-07 2:24
Stevo Z24-Apr-07 2:24 
Question(wpf) Panning & zooming Pin
Frostsnow24-Apr-07 2:11
Frostsnow24-Apr-07 2:11 
Questionhow to create an array right, if you don't know its length in advance Pin
greenpci24-Apr-07 1:49
greenpci24-Apr-07 1:49 
AnswerRe: how to create an array right, if you don't know its length in advance Pin
Christian Graus24-Apr-07 1:55
protectorChristian Graus24-Apr-07 1:55 
Generalspeed boost Pin
V.24-Apr-07 1:31
professionalV.24-Apr-07 1:31 
Hi there,

We're having a small test here at work. Read in a text file and convert half the text to uppercase as quickly as possible ("aabb" => "aAbB", so not "AAbb")
So I read in the text file and do a for with i+=2 instead of i++ and setting a Stringgbuilder. after the text is done I put text into the text box. Then I use ngen to boost speed a bit (compiler is set to optimized etc.) I also tried to use SuspenLayout and ResumeLayout, but that didn't gain me a lot.

Any other tricks I can use to boost this up? (maybe I forgot to set some compiler options or I have to do it in another way?

here's my code:
System.IO.StreamReader reader = new System.IO.StreamReader(openfiledlg.FileName);
text = new StringBuilder(reader.ReadToEnd());
reader.Close();
pb_conversion.Maximum = text.Length;
starttime = DateTime.Now;
//Starting from 1 will gain me 1 character less to analyze.
for(int i = 1; i < text.Length; i+=2){
    text[i] = text[i].ToString().ToUpper()[0];
    pb_conversion.Value = i;
}                    //end for
txtbox_result.Text = text.ToString();
difference = DateTime.Now - starttime;
lbl_result.Text = "Done in: " + difference.TotalMilliseconds + " milliseconds.";
lbl_result.Visible = true;


I'm curious what else I could do...
thanks.


V.
I found a living worth working for, but haven't found work worth living for.

GeneralRe: speed boost Pin
althamda24-Apr-07 1:54
althamda24-Apr-07 1:54 
GeneralRe: speed boost Pin
Christian Graus24-Apr-07 1:59
protectorChristian Graus24-Apr-07 1:59 
GeneralRe: speed boost Pin
V.24-Apr-07 2:18
professionalV.24-Apr-07 2:18 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 4:04
mvePete O'Hanlon24-Apr-07 4:04 
GeneralRe: speed boost Pin
V.24-Apr-07 4:14
professionalV.24-Apr-07 4:14 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 4:22
mvePete O'Hanlon24-Apr-07 4:22 
GeneralRe: speed boost Pin
althamda24-Apr-07 4:41
althamda24-Apr-07 4:41 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 5:17
mvePete O'Hanlon24-Apr-07 5:17 
QuestionHow to copy a string into a byte[] Pin
GDavy24-Apr-07 1:16
GDavy24-Apr-07 1:16 
AnswerRe: How to copy a string into a byte[] Pin
stancrm24-Apr-07 1:18
stancrm24-Apr-07 1:18 
AnswerRe: How to copy a string into a byte[] Pin
szukuro24-Apr-07 1:23
szukuro24-Apr-07 1:23 
AnswerRe: How to copy a string into a byte[] Pin
lmoelleb24-Apr-07 1:24
lmoelleb24-Apr-07 1:24 
GeneralRe: How to copy a string into a byte[] Pin
GDavy24-Apr-07 1:26
GDavy24-Apr-07 1:26 
QuestionProblem in trying to hide MenuStipItems from a static function Pin
Rocky#24-Apr-07 1:11
Rocky#24-Apr-07 1:11 
AnswerRe: Problem in trying to hide MenuStipItems from a static function Pin
kubben24-Apr-07 2:02
kubben24-Apr-07 2:02 
QuestionHow can I scroll to the beginning of a treeView? Pin
AngryC24-Apr-07 1:09
AngryC24-Apr-07 1:09 
QuestionDynamic Creation of field objects/section in Crystal report Pin
renjithgk24-Apr-07 0:42
renjithgk24-Apr-07 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.