-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8353013: java.net.URI.create(String) may have low performance to scan the host/domain name from URI string when the hostname starts with number #24295
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
Changes from 7 commits
f9157d3
cf217ee
45fb175
5e232a1
1ae19b5
f944774
4a6c3d6
47016df
07bff28
0164bca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
|
@@ -24,7 +24,7 @@ | |
/* @test | ||
* @summary Unit test for java.net.URI | ||
* @bug 4464135 4505046 4503239 4438319 4991359 4866303 7023363 7041800 | ||
* 7171415 6339649 6933879 8037396 8272072 8051627 8297687 | ||
* 7171415 6339649 6933879 8037396 8272072 8051627 8297687 8353013 | ||
* @author Mark Reinhold | ||
*/ | ||
|
||
|
@@ -1620,6 +1620,7 @@ static void bugs() { | |
b8051627(); | ||
b8272072(); | ||
b8297687(); | ||
b8353013(); | ||
} | ||
|
||
private static void b8297687() { | ||
|
@@ -1786,6 +1787,28 @@ private static void b8272072() { | |
} | ||
} | ||
|
||
// 8353013 - java.net.URI.create(String) may have low performance to scan the host/domain name from | ||
// URI string when the hostname starts with number | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment looks a bit out of place in a unit test. I think start with a JMH benchmark and change the comment in the unit test to make it clearer that it's providing more test coverage for cases where the authority component of a hierarchical URI has a host component that starts with a number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! I have updated the comment and added a JMH benchmark.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't is suspicious that non-number case got speedup too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we should consider a 30ns speed up in a single run of the benchmark on a single node as significant. |
||
private static void b8353013() { | ||
testCreate("https://0.0.0.1").s("https").h("0.0.0.1").p("").z(); | ||
testCreate("https://00.0.0.2").s("https").h("00.0.0.2").p("").z(); | ||
testCreate("https://000.0.0.3").s("https").h("000.0.0.3").p("").z(); | ||
testCreate("https://0000.0.0.4").s("https").h("0000.0.0.4").p("").z(); | ||
|
||
testCreate("https://00000.0.0.5").s("https").h("00000.0.0.5").p("").z(); | ||
testCreate("https://00001.0.0.6").s("https").h("00001.0.0.6").p("").z(); | ||
|
||
testCreate("https://01.0.0.1").s("https").h("01.0.0.1").p("").z(); | ||
|
||
testCreate("https://111111.2.3.com").s("https").h("111111.2.3.com").p("").z(); | ||
|
||
testCreate("https://1.example.com").s("https").h("1.example.com").p("").z(); | ||
testCreate("https://12.example.com").s("https").h("12.example.com").p("").z(); | ||
testCreate("https://123.example.com").s("https").h("123.example.com").p("").z(); | ||
testCreate("https://1234.example.com").s("https").h("1234.example.com").p("").z(); | ||
testCreate("https://12345.example.com").s("https").h("12345.example.com").p("").z(); | ||
rk-kmr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
switch (args.length) { | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.