473,322 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

StringBuilder question

Assuming we've defined StringBuilder myBuilder, which of the following is most expensive:

//scenario 1
myBuilder.Append("test" + "test" + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append("test");
myBuilder.Append("test");
Nov 16 '05 #1
34 1756
Jerry,

you mean more number of lines as expensive? or the performance?

I would say the correct way to do that may be

myBuilder.Append("test").Append("test1").Append("t est2");

Shak.
"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Assuming we've defined StringBuilder myBuilder, which of the following is most expensive:
//scenario 1
myBuilder.Append("test" + "test" + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append("test");
myBuilder.Append("test");

Nov 16 '05 #2
scenario 1, because a new copy of the string is being created for each +
operation (which is why there is a StringBuilder class in the first place).

However, it's possible (because of constant folding) that may actually
compile to be myBuilding.Append("testtesttest");, in which case the second
scenario would be more expensive.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Assuming we've defined StringBuilder myBuilder, which of the following is most expensive:
//scenario 1
myBuilder.Append("test" + "test" + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append("test");
myBuilder.Append("test");

Nov 16 '05 #3
And of course, both are more expensive than

someString = "test" + "test" + "test";

in both lines of code and performance.

"John Wood" <j@ro.com> wrote in message
news:ey**************@tk2msftngp13.phx.gbl...
scenario 1, because a new copy of the string is being created for each +
operation (which is why there is a StringBuilder class in the first place).
However, it's possible (because of constant folding) that may actually
compile to be myBuilding.Append("testtesttest");, in which case the second
scenario would be more expensive.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Assuming we've defined StringBuilder myBuilder, which of the following
is most expensive:

//scenario 1
myBuilder.Append("test" + "test" + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append("test");
myBuilder.Append("test");


Nov 16 '05 #4
Right. If it does implement constant folding for literal strings that may
just become an assignment of the interned string "testtesttest" (which will
just be a object handle) to a string reference variable... like 1 IL
instruction.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
And of course, both are more expensive than

someString = "test" + "test" + "test";

in both lines of code and performance.

"John Wood" <j@ro.com> wrote in message
news:ey**************@tk2msftngp13.phx.gbl...
scenario 1, because a new copy of the string is being created for each +
operation (which is why there is a StringBuilder class in the first

place).

However, it's possible (because of constant folding) that may actually
compile to be myBuilding.Append("testtesttest");, in which case the second scenario would be more expensive.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Assuming we've defined StringBuilder myBuilder, which of the following

is
most expensive:

//scenario 1
myBuilder.Append("test" + "test" + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append("test");
myBuilder.Append("test");



Nov 16 '05 #5
RE: And of course, both are more expensive than someString = "test" + "test" + "test"

Let's change this scenario. Pretend there is a string variable named example. Now, which is more expensive in terms of performance & memory alloc.

//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";
Jerry

"John Wood" wrote:
Right. If it does implement constant folding for literal strings that may
just become an assignment of the interned string "testtesttest" (which will
just be a object handle) to a string reference variable... like 1 IL
instruction.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
And of course, both are more expensive than

someString = "test" + "test" + "test";

in both lines of code and performance.

"John Wood" <j@ro.com> wrote in message
news:ey**************@tk2msftngp13.phx.gbl...
scenario 1, because a new copy of the string is being created for each +
operation (which is why there is a StringBuilder class in the first

place).

However, it's possible (because of constant folding) that may actually
compile to be myBuilding.Append("testtesttest");, in which case the second scenario would be more expensive.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
> Assuming we've defined StringBuilder myBuilder, which of the following

is
most expensive:
>
> //scenario 1
> myBuilder.Append("test" + "test" + "test");
>
> //scenario 2
> myBuilder.Append("test");
> myBuilder.Append("test");
> myBuilder.Append("test");



Nov 16 '05 #6
scenario1 probably more expensive because of the memory copying that's going
on.

Depending on the size of the string in 'example', scenario2 would probably
be the fastest.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
RE: And of course, both are more expensive than someString = "test" + "test" + "test"
Let's change this scenario. Pretend there is a string variable named example. Now, which is more expensive in terms of performance & memory
alloc.
//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";
Jerry

"John Wood" wrote:
Right. If it does implement constant folding for literal strings that may just become an assignment of the interned string "testtesttest" (which will just be a object handle) to a string reference variable... like 1 IL
instruction.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
And of course, both are more expensive than

someString = "test" + "test" + "test";

in both lines of code and performance.

"John Wood" <j@ro.com> wrote in message
news:ey**************@tk2msftngp13.phx.gbl...
> scenario 1, because a new copy of the string is being created for each + > operation (which is why there is a StringBuilder class in the first
place).
>
> However, it's possible (because of constant folding) that may actually > compile to be myBuilding.Append("testtesttest");, in which case the

second
> scenario would be more expensive.
>
> --
> John Wood
> EMail: first name, dot, last name, at priorganize.com
>
> "Jerry" <Je***@discussions.microsoft.com> wrote in message
> news:24**********************************@microsof t.com...
> > Assuming we've defined StringBuilder myBuilder, which of the following is
> most expensive:
> >
> > //scenario 1
> > myBuilder.Append("test" + "test" + "test");
> >
> > //scenario 2
> > myBuilder.Append("test");
> > myBuilder.Append("test");
> > myBuilder.Append("test");
>
>


Nov 16 '05 #7
Jerry <Je***@discussions.microsoft.com> wrote:
RE: And of course, both are more expensive than someString = "test" + "test" + "test"

Let's change this scenario. Pretend there is a string variable named
example. Now, which is more expensive in terms of performance &
memory alloc.

//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";


Scenario 3 is the cheapest: it involves a single call to String.Concat,
which is able to work out the total length of the string, allocate the
appropriate memory, and then copy the 3 strings in place.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8
According to Rico Mariani (MS performance guru), it depends. It sounds like
something like:
someString = "test" + "test" + "test";
only counts as one concatenation, so it's not really worth a StringBuilder.

Some interesting info here:
http://weblogs.asp.net/ricom/archive.../02/40778.aspx

and here:
http://weblogs.asp.net/ricom/archive.../15/43628.aspx

"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
RE: And of course, both are more expensive than someString = "test" + "test" + "test"
Let's change this scenario. Pretend there is a string variable named example. Now, which is more expensive in terms of performance & memory
alloc.
//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";
Jerry

"John Wood" wrote:
Right. If it does implement constant folding for literal strings that may just become an assignment of the interned string "testtesttest" (which will just be a object handle) to a string reference variable... like 1 IL
instruction.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
And of course, both are more expensive than

someString = "test" + "test" + "test";

in both lines of code and performance.

"John Wood" <j@ro.com> wrote in message
news:ey**************@tk2msftngp13.phx.gbl...
> scenario 1, because a new copy of the string is being created for each + > operation (which is why there is a StringBuilder class in the first
place).
>
> However, it's possible (because of constant folding) that may actually > compile to be myBuilding.Append("testtesttest");, in which case the

second
> scenario would be more expensive.
>
> --
> John Wood
> EMail: first name, dot, last name, at priorganize.com
>
> "Jerry" <Je***@discussions.microsoft.com> wrote in message
> news:24**********************************@microsof t.com...
> > Assuming we've defined StringBuilder myBuilder, which of the following is
> most expensive:
> >
> > //scenario 1
> > myBuilder.Append("test" + "test" + "test");
> >
> > //scenario 2
> > myBuilder.Append("test");
> > myBuilder.Append("test");
> > myBuilder.Append("test");
>
>


Nov 16 '05 #9
So what the hey is StringBuilder for? Can someone provide an example where using StringBuilder will be less expensive than an approach using string concatenation?

"Jon Skeet [C# MVP]" wrote:
Jerry <Je***@discussions.microsoft.com> wrote:
RE: And of course, both are more expensive than someString = "test" + "test" + "test"

Let's change this scenario. Pretend there is a string variable named
example. Now, which is more expensive in terms of performance &
memory alloc.

//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";


Scenario 3 is the cheapest: it involves a single call to String.Concat,
which is able to work out the total length of the string, allocate the
appropriate memory, and then copy the 3 strings in place.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #10
Yep, the third is still faster. Even doing it like
string myString = "test";
myString += example;
myString += "test";

it would still be faster than the corresponding StringBuilder (if you
include the required .ToString() ) in this specific example.

Keep in mind, even though this is a pet topic of mine, that we're talking
microseconds of difference for a single call so it's almost always better to
just write the code that looks the cleanest. I would consider that to be #3
in your specific example, but with a bit more complexity of the strings
being concatenated I would use string.Format() for that reason, even though
it is considerably slower than all these alternatives.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Jerry <Je***@discussions.microsoft.com> wrote:
RE: And of course, both are more expensive than someString = "test" + "test" + "test"
Let's change this scenario. Pretend there is a string variable named
example. Now, which is more expensive in terms of performance &
memory alloc.

//scenario 1
myBuilder.Append("test" + example + "test");

//scenario 2
myBuilder.Append("test");
myBuilder.Append(example);
myBuilder.Append("test");

//scenario 3
string myString = "test" + example + "test";


Scenario 3 is the cheapest: it involves a single call to String.Concat,
which is able to work out the total length of the string, allocate the
appropriate memory, and then copy the 3 strings in place.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #11
Jerry <Je***@discussions.microsoft.com> wrote:
So what the hey is StringBuilder for? Can someone provide an example
where using StringBuilder will be less expensive than an approach
using string concatenation?


Sure - any time you don't have all the information in some static way
to start with. For instance:

StringBuilder builder = new StringBuilder();
using (StreamReader reader = ...)
{
string line;
while ( (line=reader.ReadLine()) != null)
{
string word = ProcessLineSomehow();
builder.Append(word);
}
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #12
J.Marsch <je****@ctcdeveloper.com> wrote:
According to Rico Mariani (MS performance guru), it depends. It sounds like
something like:
someString = "test" + "test" + "test";
only counts as one concatenation, so it's not really worth a StringBuilder.

Some interesting info here:
http://weblogs.asp.net/ricom/archive.../02/40778.aspx

and here:
http://weblogs.asp.net/ricom/archive.../15/43628.aspx


While I haven't been able to find where it's documented, I believe the
above actually doesn't count as *any* concatenations - it compiles to
the same code as

someString = "testtesttest";

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #13
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
J.Marsch <je****@ctcdeveloper.com> wrote:
According to Rico Mariani (MS performance guru), it depends. It sounds like something like:
someString = "test" + "test" + "test";
only counts as one concatenation, so it's not really worth a StringBuilder.
Some interesting info here:
http://weblogs.asp.net/ricom/archive.../02/40778.aspx

and here:
http://weblogs.asp.net/ricom/archive.../15/43628.aspx


While I haven't been able to find where it's documented, I believe the
above actually doesn't count as *any* concatenations - it compiles to
the same code as

someString = "testtesttest";

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #14
It's also worth noting that Concat has the following overloads:

string, string
string, string, string
string, string, string, string
string[]

So if your expression has more than four +s... it'll do quite a bit more
work (constructing an array and putting each item into the array before
calling).

Although this is probably still considerably less work than what
stringbuilder would do.

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
J.Marsch <je****@ctcdeveloper.com> wrote:
According to Rico Mariani (MS performance guru), it depends. It sounds like something like:
someString = "test" + "test" + "test";
only counts as one concatenation, so it's not really worth a StringBuilder.
Some interesting info here:
http://weblogs.asp.net/ricom/archive.../02/40778.aspx

and here:
http://weblogs.asp.net/ricom/archive.../15/43628.aspx


While I haven't been able to find where it's documented, I believe the
above actually doesn't count as *any* concatenations - it compiles to
the same code as

someString = "testtesttest";

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #15
Although not specifically related to string management, you may find this
article interesting:
http://msdn.microsoft.com/library/de...anagedcode.asp

--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Jerry" <Je***@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
You're right Jon, these two commands:

string someString = "testtesttest";
string someString2 = "test" + "test" + "test";

produce the following IL:

IL_0000: ldstr "testtesttest"
IL_0005: stloc.0
IL_0006: ldstr "testtesttest"
IL_000b: stloc.1

There's your reference. :) Thanks to all for the insight!

Jerry

"Jon Skeet [C# MVP]" wrote:
J.Marsch <je****@ctcdeveloper.com> wrote:
According to Rico Mariani (MS performance guru), it depends. It sounds like something like:
someString = "test" + "test" + "test";
only counts as one concatenation, so it's not really worth a StringBuilder.
Some interesting info here:
http://weblogs.asp.net/ricom/archive.../02/40778.aspx

and here:
http://weblogs.asp.net/ricom/archive.../15/43628.aspx


While I haven't been able to find where it's documented, I believe the
above actually doesn't count as *any* concatenations - it compiles to
the same code as

someString = "testtesttest";

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #16
John Wood <j@ro.com> wrote:
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.


It shouldn't be anything to do with the JIT - it should be done at C#
compilation time, I believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #17
BUT, you're right, I even proved this myself yesterday.
The IL that it produced included the "testtesttest", which is before the JIT
even came into play... so it is the compiler.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.


It shouldn't be anything to do with the JIT - it should be done at C#
compilation time, I believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #18
BUT, you're right, I even proved this myself yesterday.
The IL that it produced included the "testtesttest", which is before the JIT
even came into play... so it is the compiler.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.


It shouldn't be anything to do with the JIT - it should be done at C#
compilation time, I believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #19
http://msdn.microsoft.com/library/en...asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.


It shouldn't be anything to do with the JIT - it should be done at C#
compilation time, I believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #20
http://msdn.microsoft.com/library/en...asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
I just tested this... it does. (compiles to ldstr "testtesttest")
Plus I saw constant folding listed as one of the JIT's optimization
features.


It shouldn't be anything to do with the JIT - it should be done at C#
compilation time, I believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #21
John Wood <j@ro.com> wrote:
http://msdn.microsoft.com/library/en...astmanagedcode
.asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?


To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I
have two static readonly fields, which are initialised to some value at
runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #22
John Wood <j@ro.com> wrote:
http://msdn.microsoft.com/library/en...astmanagedcode
.asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?


To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I
have two static readonly fields, which are initialised to some value at
runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #23
> To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible. I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is
to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... John Wood <j@ro.com> wrote:
http://msdn.microsoft.com/library/en...astmanagedcode
.asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?


To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I
have two static readonly fields, which are initialised to some value at
runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #24
> To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible. I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is
to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... John Wood <j@ro.com> wrote:
http://msdn.microsoft.com/library/en...astmanagedcode
.asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I
would consider the automatic concatenation of that string expression as
constant folding wouldn't you?


To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I
have two static readonly fields, which are initialised to some value at
runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #25
John Wood <j@ro.com> wrote:
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible. I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is
to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.


Absolutely.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is.

Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...


ngen doesn't do the same optimisations, unfortunately. However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #26
John Wood <j@ro.com> wrote:
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible. I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is
to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.


Absolutely.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is.

Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...


ngen doesn't do the same optimisations, unfortunately. However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #27
> However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do. That's a good idea. I'll have to try that some time.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m... John Wood <j@ro.com> wrote:
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me - I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as possible.

I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.


Absolutely.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is.

Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...


ngen doesn't do the same optimisations, unfortunately. However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #28
> However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do. That's a good idea. I'll have to try that some time.

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m... John Wood <j@ro.com> wrote:
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me - I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as possible.

I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.


Absolutely.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is.

Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...


ngen doesn't do the same optimisations, unfortunately. However, it's
slightly easier than that anyway - you can use cordbg and set it to
still optimise. That way you can see *all* the optimisations the JIT
will do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #29
I've got to switch newsreaders. Outlook Express had lost track of this
whole thread.

I have to say that I agree with you. I try not to be wasteful, but unless
there is a particular operation that requires the extra microseconds,
readable and maintainable is better. It helps reduce bugs -- both
initially, and during enhancements. Customers like fast software, but but
they really like software that works.
"John Wood" <j@ro.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible. I absolutely agree... I've had many arguments over this with your average

C or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is
to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is.

Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
http://msdn.microsoft.com/library/en...astmanagedcode
.asp?frame=true

This definitely lists constant folding as a feature of the JIT... and I would consider the automatic concatenation of that string expression as constant folding wouldn't you?


To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me -
I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as
possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I
have two static readonly fields, which are initialised to some value at
runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #30
Yeah but I daresay 99.9% of the time those kinds of optimizations won't make
the application appear one iota "faster" to the user. That article was
talking of differences of a few NANOseconds. Please!

"J.Marsch" <je****@ctcdeveloper.com> wrote in message
news:Oq**************@TK2MSFTNGP09.phx.gbl...
I've got to switch newsreaders. Outlook Express had lost track of this
whole thread.

I have to say that I agree with you. I try not to be wasteful, but unless
there is a particular operation that requires the extra microseconds,
readable and maintainable is better. It helps reduce bugs -- both
initially, and during enhancements. Customers like fast software, but but they really like software that works.
"John Wood" <j@ro.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to me - I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as possible. I absolutely agree... I've had many arguments over this with your average C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.
Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and ask
them...

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <j@ro.com> wrote:
> http://msdn.microsoft.com/library/en...astmanagedcode > .asp?frame=true
>
> This definitely lists constant folding as a feature of the JIT... and I > would consider the automatic concatenation of that string expression as > constant folding wouldn't you?

To be honest, I'm not a big fan of that article. The idea of writing
the fastest possible code all the time is not one which appeals to

me - I far prefer to write *elegant* code which is easy to read, write and
maintain, and optimise any code which actually *needs* to be as fast as possible.

Now, having said that, I'd have to look at exactly what is meant by
"constant folding" as far as the JIT is concerned. There may well be
things that the JIT can do which the compiler can't - they probably
have very different ideas of what a constant is. For example, suppose I have two static readonly fields, which are initialised to some value at runtime. The product of those fields *isn't* something the C# compiler
can compute and use once as a constant, but it *is* something the JIT
compiler might be able to do something with, depending on when it's
doing the JIT-compilation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



Nov 16 '05 #31
Stringbuilder is most useful when you are in a loop, ie..

foreach (DictionaryEntry entry in m_hash)
{
sb.Append( Utils.SqlClean( entry.Value ) );
sb.Append( " = " );
sb.Append( quoteChar );
sb.Append( Utils.SqlClean( entry.Value ) );
sb.Append( quoteChar );
}

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #32
Yes, exactly as I said in my last post. I agreed with Jon Skeet about
making code readable and maintainable over squeezing out every last bit of
performance at the cost of readability. (unless there is an operation that
requires the extra time). I do find that it's pretty rare that you have
something that needs to be so tight. When I have seen situations like that,
it's usually server-side code, where the performance cost of an operation is
multiplied by the number of concurrent users. I've seen situations there
where you make some compromises to wring extra cycles, but even in those
situations, I lean towards elegance.
"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Yeah but I daresay 99.9% of the time those kinds of optimizations won't make the application appear one iota "faster" to the user. That article was
talking of differences of a few NANOseconds. Please!

"J.Marsch" <je****@ctcdeveloper.com> wrote in message
news:Oq**************@TK2MSFTNGP09.phx.gbl...
I've got to switch newsreaders. Outlook Express had lost track of this
whole thread.

I have to say that I agree with you. I try not to be wasteful, but unless
there is a particular operation that requires the extra microseconds,
readable and maintainable is better. It helps reduce bugs -- both
initially, and during enhancements. Customers like fast software, but but
they really like software that works.
"John Wood" <j@ro.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> To be honest, I'm not a big fan of that article. The idea of writing
> the fastest possible code all the time is not one which appeals to me - > I far prefer to write *elegant* code which is easy to read, write and > maintain, and optimise any code which actually *needs* to be as fast as > possible.
I absolutely agree... I've had many arguments over this with your average
C
or C++ programmer, who are typically obsessed with writing faster code
rather than maintainable code.

Most of the time is considerably cheaper to buy faster hardware than it is to waste weeks or even months of developer time maintaining messy and
bug-ridden "hand-optimized" code.

> Now, having said that, I'd have to look at exactly what is meant by
> "constant folding" as far as the JIT is concerned. There may well be
> things that the JIT can do which the compiler can't - they probably
> have very different ideas of what a constant is.
Probably the only way of telling is to ngen the code and analyze the
assembly. Or just find a blog of someone responsible for the JIT and
ask them...

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
> John Wood <j@ro.com> wrote:
> >
http://msdn.microsoft.com/library/en...astmanagedcode > > .asp?frame=true
> >
> > This definitely lists constant folding as a feature of the JIT... and
I
> > would consider the automatic concatenation of that string expression as
> > constant folding wouldn't you?
>
> To be honest, I'm not a big fan of that article. The idea of writing
> the fastest possible code all the time is not one which appeals to

me - > I far prefer to write *elegant* code which is easy to read, write
and > maintain, and optimise any code which actually *needs* to be as fast

as > possible.
>
> Now, having said that, I'd have to look at exactly what is meant by
> "constant folding" as far as the JIT is concerned. There may well be
> things that the JIT can do which the compiler can't - they probably
> have very different ideas of what a constant is. For example, suppose I
> have two static readonly fields, which are initialised to some value at > runtime. The product of those fields *isn't* something the C#

compiler > can compute and use once as a constant, but it *is* something the JIT > compiler might be able to do something with, depending on when it's
> doing the JIT-compilation.
>
> --
> Jon Skeet - <sk***@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



Nov 16 '05 #33
Sorry, I wasn't meaning to sound like I was disagreeing with you, if that's
the way you took it. I would add also that in the case of server code the
"fix it with hardware" is an even more reasonable solution. You can buy
some pretty big performance jumps in hardware for a week of our salaries.

"J.Marsch" <je****@ctcdeveloper.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Yes, exactly as I said in my last post. I agreed with Jon Skeet about
making code readable and maintainable over squeezing out every last bit of
performance at the cost of readability. (unless there is an operation that requires the extra time). I do find that it's pretty rare that you have
something that needs to be so tight. When I have seen situations like that, it's usually server-side code, where the performance cost of an operation is multiplied by the number of concurrent users. I've seen situations there
where you make some compromises to wring extra cycles, but even in those
situations, I lean towards elegance.

Nov 16 '05 #34
No pain taken -- from my read, I wasn't sure whether you were interpreting
my original post differently than I had intended, so I was just trying to
clear it up. Yah, you can do a lot with hardware these days -- palm-tops
are running higher mhz than my first development machine. The only downside
is if you are writing commercial software, customers hate to hear that they
have to buy a faster server to run your latest software.

On the one hand, I see their point -- they want to have some confidence that
the code is efficient, and that we are not crutching on hardware to push
costs on to them (costs that would otherwise be incurred by us in the course
of performance tuning our software).

On the other hand, it seems perfectly reasonable to me that if you want to
do more stuff in the same amount of time, you should expect to need a faster
hardware.

That's kind of a delicate balance, isn't it? Overall, though I do find that
I strongly lean more towards elegance over performance. If seems like if
you keep it like that, then in the rare situations where you have to write
some tricky code, you can encapsulate (blackbox)/comment/chart/document it
well enough that you accomplish your performance goals without sacrificing
too much clarity (due to the rarity of the issue)

Anyway, I think we're both on the same side of the line on this one.

Cheers.

-- Jeremy

"Daniel Billingsley" <dbillingsley@NO_durcon_SPAAMM.com> wrote in message
news:eA**************@TK2MSFTNGP11.phx.gbl...
Sorry, I wasn't meaning to sound like I was disagreeing with you, if that's the way you took it. I would add also that in the case of server code the
"fix it with hardware" is an even more reasonable solution. You can buy
some pretty big performance jumps in hardware for a week of our salaries.

"J.Marsch" <je****@ctcdeveloper.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Yes, exactly as I said in my last post. I agreed with Jon Skeet about
making code readable and maintainable over squeezing out every last bit of performance at the cost of readability. (unless there is an operation that
requires the extra time). I do find that it's pretty rare that you have
something that needs to be so tight. When I have seen situations like

that,
it's usually server-side code, where the performance cost of an operation is
multiplied by the number of concurrent users. I've seen situations

there where you make some compromises to wring extra cycles, but even in those
situations, I lean towards elegance.


Nov 16 '05 #35

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: Kevin C | last post by:
Quick Question: StringBuilder is obviously more efficient dealing with string concatenations than the old '+=' method... however, in dealing with relatively large string concatenations (ie,...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
2
by: Peter | last post by:
Hi, A newbie question .. I want to use an array of length 4 while each array element is a string of 40 chars. I typed .. StringBuilder title = new StringBuilder(40);
5
by: Christof Nordiek | last post by:
Hi, in my Application i have to make a Copy of a StringBuilder, so that, if the new old instance is changed, the you instance will not be affected. I could do something like new...
9
by: Peter Row | last post by:
Hi, I know this has been asked before, but reading the threads it is still not entirely clear. Deciding which .Replace( ) to use when. Typically if I create a string in a loop I always use a...
15
by: DV | last post by:
I have a StringBuilder that has a string with 12,000,000 characters. When I do a ToString(), I expect to have ~25,000,000 bytes worth of memory, yet, I end up with ~43,000,000 bytes. That's...
7
by: KH | last post by:
API question... Why doesn't StringBuilder have IndexOf and other similar methods like String? I can't think of a good reason off the top of my head. Easy to write helper functions to do the...
12
by: Richard Lewis Haggard | last post by:
I thought that the whole point of StringBuilder was that it was supposed to be a faster way of building strings than string. However, I just put together a simple little application to do a...
26
by: Hardy Wang | last post by:
Hi all, I know it is better to handle large string with a StringBuilder, but how does StringBuilder class improve the performance in the background? Thanks! -- WWW:...
3
by: Morgan Cheng | last post by:
In P/Invoke situation, If some *out* parameter is LPWSTR, I can use string or StringBuilder. However, there is one problem about StringBuilder. By default, its Capacity is 16. If the returned...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.