This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Description Processing dotnet/runtime#124433 (comment) command:
Original command:
using BenchmarkDotNet . Attributes ;
using BenchmarkDotNet . Running ;
BenchmarkSwitcher . FromAssembly ( typeof ( Bench ) . Assembly ) . Run ( args ) ;
public class Bench
{
private string _noUserInfoShortHost = default ! ;
private string _noUserInfoLongHost = default ! ;
private string _withUserInfoShortHost = default ! ;
private string _withUserInfoLongHost = default ! ;
private string _basicHostShortPath = default ! ;
private string _basicHostLongPath = default ! ;
private Uri _baseUri = default ! ;
private string _relativeWithScheme = default ! ;
private string _relativeNoScheme = default ! ;
[ GlobalSetup ]
public void Setup ( )
{
_noUserInfoShortHost = "http://host/path" ;
_noUserInfoLongHost = "http://" + new string ( 'a' , 64 ) + ".example.com/path" ;
_withUserInfoShortHost = "http://user:pass@host/path" ;
_withUserInfoLongHost = "http://user:pass@" + new string ( 'a' , 64 ) + ".example.com/path" ;
_basicHostShortPath = "myscheme://host/path" ;
_basicHostLongPath = "myscheme://" + new string ( 'a' , 64 ) + ".example.com/path?query#fragment" ;
_baseUri = new Uri ( "http://base.example.com/basepath/" ) ;
_relativeWithScheme = "http://other.example.com/otherpath" ;
_relativeNoScheme = "relative/path?query#fragment" ;
UriParser . Register ( new GenericUriParser ( GenericUriParserOptions . Default ) , "myscheme" , - 1 ) ;
}
[ Benchmark ]
public Uri NoUserInfo_ShortHost ( ) => new Uri ( _noUserInfoShortHost ) ;
[ Benchmark ]
public Uri NoUserInfo_LongHost ( ) => new Uri ( _noUserInfoLongHost ) ;
[ Benchmark ]
public Uri WithUserInfo_ShortHost ( ) => new Uri ( _withUserInfoShortHost ) ;
[ Benchmark ]
public Uri WithUserInfo_LongHost ( ) => new Uri ( _withUserInfoLongHost ) ;
[ Benchmark ]
public Uri BasicHost_ShortPath ( ) => new Uri ( _basicHostShortPath ) ;
[ Benchmark ]
public Uri BasicHost_LongPath ( ) => new Uri ( _basicHostLongPath ) ;
[ Benchmark ]
public Uri CombinedString_WithScheme ( ) => new Uri ( _baseUri , _relativeWithScheme ) ;
[ Benchmark ]
public Uri CombinedString_NoScheme ( ) => new Uri ( _baseUri , _relativeNoScheme ) ;
}
(EgorBot will reply in this issue )
Reactions are currently unavailable
Processing dotnet/runtime#124433 (comment) command:
Original command:
(EgorBot will reply in this issue)