Uh oh!
There was an error while loading. Please reload this page.
Optimize HttpUtility.UrlEncodeToBytes for (string, Encoding) overload. - #102805
Conversation
Tagging subscribers to this area: @dotnet/ncl |
TrayanZapryanov
commented
May 29, 2024
Benchmark: [MemoryDiagnoser]publicclassHttpUtilityBenchmarks{[Benchmark(Baseline=true)]publicbyte[]UrlEncodeToBytes()=>HttpUtility.UrlEncodeToBytes("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r");[Benchmark]publicbyte[]UrlEncodeToBytes_PR()=>MyHttpUtility.UrlEncodeToBytes("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r");}Result:
|
EgorBo
commented
May 29, 2024
Please, ignore me, I am just testing my bot 🙂 @EgorBot -arm64 -amd -profiler usingSystem.Web;usingBenchmarkDotNet.Attributes;usingBenchmarkDotNet.Running;BenchmarkRunner.Run<HttpUtilityBenchmarks>(args:args);publicclassHttpUtilityBenchmarks{[Benchmark(Baseline=true)]publicbyte[]UrlEncodeToBytes()=>HttpUtility.UrlEncodeToBytes("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r");} |
EgorBot
commented
May 29, 2024
|
EgorBot
commented
May 29, 2024
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d550e79 to
da876e9CompareTrayanZapryanov
commented
May 31, 2024
Final benchmark results:
|
TrayanZapryanov
commented
May 31, 2024
@EgorBot -arm64 -amd -profiler |
EgorBot
commented
May 31, 2024
EgorBot manualAll targets are Linux-only at the moment. NOTE: [DisassemblyDiagnoser] may cause unexpected crashes in BDN on Linux (at least on x64) Usage example: link |
Uh oh!
There was an error while loading. Please reload this page.
TrayanZapryanov
commented
May 31, 2024
@EgorBot -arm64 -amd |
EgorBot
commented
May 31, 2024
EgorBot manualAll targets are Linux-only at the moment. NOTE: [DisassemblyDiagnoser] may cause unexpected crashes in BDN on Linux (at least on x64) Usage example: link |
TrayanZapryanov
commented
May 31, 2024
@EgorBot -arm64 -amd -profiler using System.Web; BenchmarkRunner.Run(args: args); public class HttpUtilityBenchmarks |
EgorBot
commented
May 31, 2024
EgorBot manualAll targets are Linux-only at the moment. NOTE: [DisassemblyDiagnoser] may cause unexpected crashes in BDN on Linux (at least on x64) Usage example: link |
TrayanZapryanov
commented
May 31, 2024
@EgorBot -arm64 -amd -profiler usingSystem.Web;usingBenchmarkDotNet.Attributes;usingBenchmarkDotNet.Running;BenchmarkRunner.Run<HttpUtilityBenchmarks>(args:args);publicclassHttpUtilityBenchmarks{[Benchmark(Baseline=true)]publicbyte[]UrlEncodeToBytes()=>HttpUtility.UrlEncodeToBytes("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r");} |
EgorBot
commented
May 31, 2024
Benchmark results on Amd
Flame graphs: Main vs PR 🔥 For clean |
EgorBot
commented
May 31, 2024
Benchmark results on Arm64
Flame graphs: Main vs PR 🔥 For clean |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Do not allocate byte[] if Encoding.GetMaxByteCount for the string parameter is less than 512 characters.
In this case just encode in stackalloc array.