Skip to content

Conversation

@MihaZupan
Copy link
Collaborator

Addresses #258

The issue with the Specs file remains, do you want me to commit it anyway?

if (!c.IsAlphaNumeric())
{
if (c == '/') // End of domain name
if (c == '/' || c == '?' || c == '#' || c == ':') // End of domain name
Copy link

@AdmiringWorm AdmiringWorm Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an opinion:

this could perhaps also be written as:

if ("/?#:".Contains(c))

This would allow it to be extended to more characters in the future if needed (well, easier to extend).
Don't know if there is any performance difference though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to personal taste I guess.
Performance-wise it doesn't really matter in this case, I just try to stick to the same style as the rest of the library.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just made a benchmark comparison for 5 characters in a tests (between contains and ==)

   Method |     Mean |     Error |    StdDev |   Median |
--------- |---------:|----------:|----------:|---------:|
 Contains | 641.7 ns | 12.833 ns | 31.959 ns | 629.5 ns |
   Equals | 254.1 ns |  5.030 ns |  8.403 ns | 253.0 ns |

And it seems that Equals is still faster. So yeah, let's keep equals in that case

@xoofx
Copy link
Owner

xoofx commented Oct 29, 2018

Thanks for this fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants