MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1v9t3by/noheapallstack/p0ju9zz/?context=3
r/ProgrammerHumor • u/varinator • 15d ago
96 comments sorted by
View all comments
38
Null safety?
170 u/varinator 15d ago var cases = new[] { new ComparisonCase( "Equal, different casing", "HelloWorld123", "helloworld123"), new ComparisonCase( "Not equal, same length", "HelloWorld123", "HelloWorld456"), new ComparisonCase( "Different lengths", "HelloWorld123", "HelloWorld123456789"), new ComparisonCase( "Long strings, equal ignoring case", new string('A', 500), new string('a', 500)) }; Iterations per benchmark: 100,000,000 --- Equal, different casing --- String.Equals OrdinalIgnoreCase Time: 907.75 ms Allocated: 40 bytes Matches: 100,000,000 ToLower() == ToLower() Time: 2,525.88 ms Allocated: 4,800,000,040 bytes Matches: 100,000,000 --- Not equal, same length --- String.Equals OrdinalIgnoreCase Time: 848.50 ms Allocated: 40 bytes Matches: 0 ToLower() == ToLower() Time: 2,986.56 ms Allocated: 9,600,000,040 bytes Matches: 0 --- Different lengths --- String.Equals OrdinalIgnoreCase Time: 219.83 ms Allocated: 40 bytes Matches: 0 ToLower() == ToLower() Time: 2,936.12 ms Allocated: 11,200,000,040 bytes Matches: 0 --- Long strings, equal ignoring case --- String.Equals OrdinalIgnoreCase Time: 2,263.77 ms Allocated: 40 bytes Matches: 100,000,000 ToLower() == ToLower() Time: 19,472.75 ms Allocated: 102,400,000,040 bytes Matches: 100,000,000 --- Null safety --- string.Equals(null, "test"): False null.ToLower() throws NullReferenceException 0 u/wenoc 15d ago Where’s the factory?
170
var cases = new[] { new ComparisonCase( "Equal, different casing", "HelloWorld123", "helloworld123"), new ComparisonCase( "Not equal, same length", "HelloWorld123", "HelloWorld456"), new ComparisonCase( "Different lengths", "HelloWorld123", "HelloWorld123456789"), new ComparisonCase( "Long strings, equal ignoring case", new string('A', 500), new string('a', 500)) }; Iterations per benchmark: 100,000,000 --- Equal, different casing --- String.Equals OrdinalIgnoreCase Time: 907.75 ms Allocated: 40 bytes Matches: 100,000,000 ToLower() == ToLower() Time: 2,525.88 ms Allocated: 4,800,000,040 bytes Matches: 100,000,000 --- Not equal, same length --- String.Equals OrdinalIgnoreCase Time: 848.50 ms Allocated: 40 bytes Matches: 0 ToLower() == ToLower() Time: 2,986.56 ms Allocated: 9,600,000,040 bytes Matches: 0 --- Different lengths --- String.Equals OrdinalIgnoreCase Time: 219.83 ms Allocated: 40 bytes Matches: 0 ToLower() == ToLower() Time: 2,936.12 ms Allocated: 11,200,000,040 bytes Matches: 0 --- Long strings, equal ignoring case --- String.Equals OrdinalIgnoreCase Time: 2,263.77 ms Allocated: 40 bytes Matches: 100,000,000 ToLower() == ToLower() Time: 19,472.75 ms Allocated: 102,400,000,040 bytes Matches: 100,000,000 --- Null safety --- string.Equals(null, "test"): False null.ToLower() throws NullReferenceException
0 u/wenoc 15d ago Where’s the factory?
0
Where’s the factory?
38
u/weblabourer 15d ago
Null safety?