dotnet / dotnet/BenchmarkDotNet
Stringbuilder freezes the test...
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 1.1k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 12
Description
Hi.
I'm trying to benchmark two simple functions, where "Global_Var" strings with ~30 characters each.
```
Public Function SB1() As String
Public_StringBuilder.Clear()
Public_StringBuilder.Append(Global_Var1)
Public_StringBuilder.Append(Global_Var2)
Public_StringBuilder.Append(Global_Var3)
Public_StringBuilder.Append("apeas um teste de troca de valores XXX por YYY")
Return Public_StringBuilder.ToString.Replace("XXX", "DESSE TYPO X").Replace("YYY", "por ESTE AQUI")
End Function
Public Function SB2() As String
Public_StringBuilder.Clear()
Public_StringBuilder.Append(Global_Var1)
Public_StringBuilder.Append(Global_Var2)
Public_StringBuilder.Append(Global_Var3)
Public_StringBuilder.Append("apeas um teste de troca de valores XXX por YYY")
Public_StringBuilder.Replace("XXX", "DESSE TYPO X")
Public_StringBuilder.Replace("YYY", "por ESTE AQUI")
Return Public_StringBuilder.ToString
End Function
```
The problem is related to:
1- The test never ends, consuming 15%-22% of an i9-7900X w/64Gb RAM.
2- Even if I define "no WarmUp" and other settings, BDN performs them.
3- When I type CTRL-C on the CMD window, the job continues indefinitely, and I have to call Task Manager and kill it
See this print, similar to all others I got in 2 hours trying to conduct this test.

My Job parameters are:
```
ManualConfig.CreateEmpty().AddJob(Job.Default.WithRuntime(ClrRuntime.Net48) _
.WithPlatform(Platform.AnyCpu) _
.WithJit(Jit.RyuJit) _
.WithWarmupCount(0) _
.WithStrategy(RunStrategy.ColdStart) _
.WithMaxIterationCount(1) _
.WithMaxWarmupCount(0) _
.WithLaunchCount(1) _
.WithBaseline(True))
Dim summary = BenchmarkRunner.Run(Of Benchmarks)()
```
Thanks for any help...
Contributor guide
Assessment
This issue has not been assessed yet.