Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e060baef
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e060baef
编写于
2月 16, 2015
作者:
L
lpriima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8073124: Tune test and document TimSort runs length stack size increase
Reviewed-by: dholmes
上级
a851f16e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
24 addition
and
8 deletion
+24
-8
src/share/classes/java/util/ComparableTimSort.java
src/share/classes/java/util/ComparableTimSort.java
+4
-0
src/share/classes/java/util/TimSort.java
src/share/classes/java/util/TimSort.java
+4
-0
test/java/util/Arrays/TimSortStackSize2.java
test/java/util/Arrays/TimSortStackSize2.java
+16
-8
未找到文件。
src/share/classes/java/util/ComparableTimSort.java
浏览文件 @
e060baef
...
@@ -144,6 +144,10 @@ class ComparableTimSort {
...
@@ -144,6 +144,10 @@ class ComparableTimSort {
* large) stack lengths for smaller arrays. The "magic numbers" in the
* large) stack lengths for smaller arrays. The "magic numbers" in the
* computation below must be changed if MIN_MERGE is decreased. See
* computation below must be changed if MIN_MERGE is decreased. See
* the MIN_MERGE declaration above for more information.
* the MIN_MERGE declaration above for more information.
* The maximum value of 49 allows for an array up to length
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
* increasing scenario. More explanations are given in section 4 of:
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
*/
*/
int
stackLen
=
(
len
<
120
?
5
:
int
stackLen
=
(
len
<
120
?
5
:
len
<
1542
?
10
:
len
<
1542
?
10
:
...
...
src/share/classes/java/util/TimSort.java
浏览文件 @
e060baef
...
@@ -174,6 +174,10 @@ class TimSort<T> {
...
@@ -174,6 +174,10 @@ class TimSort<T> {
* large) stack lengths for smaller arrays. The "magic numbers" in the
* large) stack lengths for smaller arrays. The "magic numbers" in the
* computation below must be changed if MIN_MERGE is decreased. See
* computation below must be changed if MIN_MERGE is decreased. See
* the MIN_MERGE declaration above for more information.
* the MIN_MERGE declaration above for more information.
* The maximum value of 49 allows for an array up to length
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
* increasing scenario. More explanations are given in section 4 of:
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
*/
*/
int
stackLen
=
(
len
<
120
?
5
:
int
stackLen
=
(
len
<
120
?
5
:
len
<
1542
?
10
:
len
<
1542
?
10
:
...
...
test/java/util/Arrays/TimSortStackSize2.java
浏览文件 @
e060baef
...
@@ -24,10 +24,10 @@
...
@@ -24,10 +24,10 @@
/*
/*
* @test
* @test
* @bug 8072909
* @bug 8072909
* @run main/othervm TimSortStackSize2 67108864
* @run main/othervm
-Xmx385m
TimSortStackSize2 67108864
* not for regular execution on all platforms:
* not for regular execution on all platforms:
* run main/othervm -Xmx8g TimSortStackSize2 1073741824
* run main/othervm -Xmx8g TimSortStackSize2 1073741824
* run main/othervm -Xmx
32
g TimSortStackSize2 2147483644
* run main/othervm -Xmx
16
g TimSortStackSize2 2147483644
* @summary Test TimSort stack size on big arrays
* @summary Test TimSort stack size on big arrays
*/
*/
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -41,22 +41,30 @@ public class TimSortStackSize2 {
...
@@ -41,22 +41,30 @@ public class TimSortStackSize2 {
int
lengthOfTest
=
Integer
.
parseInt
(
args
[
0
]);
int
lengthOfTest
=
Integer
.
parseInt
(
args
[
0
]);
boolean
passed
=
true
;
boolean
passed
=
true
;
try
{
try
{
Arrays
.
sort
(
new
TimSortStackSize2
(
lengthOfTest
).
createArray
(),
Integer
[]
a
=
new
TimSortStackSize2
(
lengthOfTest
).
createArray
();
new
Comparator
<
Object
>()
{
long
begin
=
System
.
nanoTime
();
Arrays
.
sort
(
a
,
new
Comparator
<
Object
>()
{
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
int
compare
(
Object
first
,
Object
second
)
{
public
int
compare
(
Object
first
,
Object
second
)
{
return
((
Comparable
<
Object
>)
first
).
compareTo
(
second
);
return
((
Comparable
<
Object
>)
first
).
compareTo
(
second
);
}
}
});
});
System
.
out
.
println
(
"TimSort OK"
);
long
end
=
System
.
nanoTime
();
System
.
out
.
println
(
"TimSort: "
+
(
end
-
begin
));
a
=
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
){
}
catch
(
ArrayIndexOutOfBoundsException
e
){
System
.
out
.
println
(
"TimSort broken"
);
System
.
out
.
println
(
"TimSort broken
:
"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
passed
=
false
;
passed
=
false
;
}
}
try
{
try
{
Arrays
.
sort
(
new
TimSortStackSize2
(
lengthOfTest
).
createArray
());
Integer
[]
a
=
new
TimSortStackSize2
(
lengthOfTest
).
createArray
();
System
.
out
.
println
(
"ComparableTimSort OK"
);
long
begin
=
System
.
nanoTime
();
Arrays
.
sort
(
a
);
long
end
=
System
.
nanoTime
();
System
.
out
.
println
(
"ComparableTimSort: "
+
(
end
-
begin
));
a
=
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
){
}
catch
(
ArrayIndexOutOfBoundsException
e
){
System
.
out
.
println
(
"ComparableTimSort broken:"
);
System
.
out
.
println
(
"ComparableTimSort broken:"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录