FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jruby/bench/java/bench_java_arrays.rb at test-latest_java8 · MSNexploder/jruby · GitHub
MSNexploder
/
jruby
Public
forked from
jruby/jruby
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
jruby
/
bench
/
java
/
bench_java_arrays.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (14 loc) · 690 Bytes
Breadcrumbs
jruby
/
bench
/
java
/
bench_java_arrays.rb
Copy path
File metadata and controls
16 lines (14 loc) · 690 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require
'java'
require
'benchmark'
TIMES
=
(
ARGV
[
0
]
||
5
)
.
to_i
TIMES
.
times
do
Benchmark
.
bm
(
30
)
do
|
bm
|
bm
.
report
(
"control"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
}
}
bm
.
report
(
"java_ary[0]"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
[
0
]
}
}
bm
.
report
(
"java_ary[0] = 1"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
[
0
]
=
1
}
}
bm
.
report
(
"java_ary[1,2]"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
[
1
,
2
]
}
}
bm
.
report
(
"java_ary.each {|x|}"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
.
each
{
|
x
|
}
}
}
bm
.
report
(
"java_ary + java_ary"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
+
a
}
}
bm
.
report
(
"java_ary.to_a"
)
{
a
=
[
1
,
2
,
3
,
4
]
.
to_java
;
1_000_000
.
times
{
a
.
to_a
}
}
end
end
Back
|
FazBrowse Home
|
New Git URL