New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Url class performance #575
Comments
I think the parser itself could be a little bit faster, but I would first see a straight comparison of Uri to Url (especially with some use cases, e.g., tolerances and relative URLs). |
I see. Couldn't we build on those tolerances with some extensions? |
Unfortunately not, but feel free to look for a way. |
@FlorianRappl if you can describe 1-2 use cases that wouldn't work with |
Just run the unit tests of Bringing some failing examples:
If you think these URLs are weird - yes of course they are. As explained it is not about the standard URLs, but rather about the goofy ones. They are interpreted correctly in the browser - and in AngleSharp. They lead to errors in |
Hm... what if |
I think this would be way slower. Have you ever compared how long Also you would spawn 2 object instances instead of one. So this would increase memory even more. |
Made a very simple benchmark consisting of the following (happy) URLs: var urls = new []
{
"http://localhost:8080/?mytest",
"https://www.google.de/mypath",
"http://www.google.de",
"http://example.org/foo/bar",
"http://example-domain.com/image.jpg",
"https://github.com/FlorianRappl/AngleSharp",
"http://www.google.de/some-path?a=b#header",
"http://test/?hi—there",
"http://example_domain.com/image.jpg",
"https://loony_picture.dirty.ru/",
"http://localhost:12345/account/login",
"http://www.google.de/some-path#"
};
Benchmark(urls, url => new Url(url));
Benchmark(urls, url => new Uri(url));
|
Hey @FlorianRappl
I was profiling some of my code yesterday and found that
Url
is pretty slow - in 25,000 requests that take around 45sec, 8s was spent inUrl
. Unfortunately it didn't give me the stack trace of what was calling the constructor (I was only constructing the url myself once).How come you're not using Uri?
The text was updated successfully, but these errors were encountered: