Click here to Skip to main content
15,906,455 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionExport to Excel or html [modified] Pin
zzsoulzz28-Jul-08 7:27
zzsoulzz28-Jul-08 7:27 
AnswerRe: Export to Excel or html Pin
Paul Conrad28-Jul-08 10:50
professionalPaul Conrad28-Jul-08 10:50 
GeneralRe: Export to Excel or html Pin
zzsoulzz28-Jul-08 20:19
zzsoulzz28-Jul-08 20:19 
GeneralRe: Export to Excel or html Pin
Paul Conrad28-Jul-08 20:22
professionalPaul Conrad28-Jul-08 20:22 
GeneralRe: Export to Excel or html Pin
zzsoulzz28-Jul-08 20:32
zzsoulzz28-Jul-08 20:32 
QuestionString concat slow despite Stringbuilder Pin
frylord28-Jul-08 4:20
frylord28-Jul-08 4:20 
AnswerRe: String concat slow despite Stringbuilder Pin
Roger Alsing28-Jul-08 4:44
Roger Alsing28-Jul-08 4:44 
AnswerRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 5:18
sitebuilderLuc Pattyn28-Jul-08 5:18 
Hi,

1.
you can't get an accurate delay like that. Sleep causes a thread switch, and it could take any
number of milliseconds before your thread is allowed back in.
for more accurate timing stuff, you may want to read my timers article.

2.
if you want to measure StringBuilder.Append performance, make a loop that contains just that;
no threading stuff, no backgrounders, no GUI access. Loop it many many times and use a StopWatch
to measure it. (BTW my article does not mention StopWatch, it was based on NET 1.x and StopWatch
got introduced with 2.0; I am working on an update).

3.
If you want maximum StringBuilder performance, make sure it has sufficient capacity right from
the start. If you don't, it will outrun its capacity, allocate a new and larger buffer
(typ. twice as large) and copy what it had so far. Your example needed around 500K characters, so
about two megabytes of unnecessary data copying have occured. Of course, using string instead of
StringBuilder would have been much much worse.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Voting for dummies? No thanks. Dead | X|


GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 5:59
frylord28-Jul-08 5:59 
AnswerRe: String concat slow despite Stringbuilder Pin
Chinners28-Jul-08 5:33
Chinners28-Jul-08 5:33 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 6:01
frylord28-Jul-08 6:01 
AnswerRe: String concat slow despite Stringbuilder Pin
Paul Conrad28-Jul-08 5:52
professionalPaul Conrad28-Jul-08 5:52 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 6:08
frylord28-Jul-08 6:08 
GeneralRe: String concat slow despite Stringbuilder Pin
Paul Conrad28-Jul-08 6:12
professionalPaul Conrad28-Jul-08 6:12 
GeneralRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 6:21
sitebuilderLuc Pattyn28-Jul-08 6:21 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 6:52
frylord28-Jul-08 6:52 
GeneralRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 7:07
sitebuilderLuc Pattyn28-Jul-08 7:07 
AnswerRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 6:11
sitebuilderLuc Pattyn28-Jul-08 6:11 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 6:27
frylord28-Jul-08 6:27 
GeneralRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 6:43
sitebuilderLuc Pattyn28-Jul-08 6:43 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 7:02
frylord28-Jul-08 7:02 
GeneralRe: String concat slow despite Stringbuilder Pin
Luc Pattyn28-Jul-08 7:10
sitebuilderLuc Pattyn28-Jul-08 7:10 
GeneralRe: String concat slow despite Stringbuilder Pin
frylord28-Jul-08 7:25
frylord28-Jul-08 7:25 
QuestionList Box item coloring Pin
Saam_cse28-Jul-08 1:02
Saam_cse28-Jul-08 1:02 
AnswerRe: List Box item coloring Pin
Luc Pattyn28-Jul-08 1:14
sitebuilderLuc Pattyn28-Jul-08 1:14 

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.