FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jruby/bench/java/bench_java_invocation.rb at test_github_468 · 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_invocation.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
121 lines (107 loc) · 1.98 KB
Breadcrumbs
jruby
/
bench
/
java
/
bench_java_invocation.rb
Copy path
File metadata and controls
121 lines (107 loc) · 1.98 KB
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
require
'benchmark'
require
'java'
import
java
.
lang
.
System
puts
"Measure bytelist appends (via Java integration)"
5
.
times
{
puts
Benchmark
.
measure
{
sb
=
org
.
jruby
.
util
.
ByteList
.
new
foo
=
org
.
jruby
.
util
.
ByteList
.
plain
(
"foo"
)
1000000
.
times
{
sb
.
append
(
foo
)
}
}
}
puts
"Measure string appends (via normal Ruby)"
5
.
times
{
puts
Benchmark
.
measure
{
str
=
""
foo
=
"foo"
1000000
.
times
{
str
<<
foo
}
}
}
puts
"Measure System.currentTimeMillis, int becoming Fixnum"
def
System
.
bench
x
=
nil
1000000
.
times
{
x
=
currentTimeMillis
}
end
5
.
times
{
puts
Benchmark
.
measure
{
System
.
bench
}
}
puts
"Measure string.length, integer length to fixnum"
5
.
times
{
puts
Benchmark
.
measure
{
x
=
""
1000000
.
times
{
y
=
x
.
length
}
}
}
puts
"Measure java.lang.Thread#name, String entering Ruby"
JThread
=
java
::
lang
::
Thread
class
JThread
def
bench
x
=
nil
1000000
.
times
{
x
=
name
}
end
end
5
.
times
{
puts
Benchmark
.
measure
{
JThread
.
currentThread
.
bench
}
}
puts
"Measure ArrayList.set(fixnum, string), String leaving Ruby"
5
.
times
{
puts
Benchmark
.
measure
{
str
=
"foo"
alist
=
java
.
util
.
ArrayList
.
new
(
1
)
alist
<<
str
1000000
.
times
{
alist
.
set
(
0
,
str
)
}
}
}
puts
"Measure Fixnum#to_s, String being constructed"
5
.
times
{
puts
Benchmark
.
measure
{
x
=
1
1000000
.
times
{
y
=
x
.
to_s
}
}
}
puts
"Measure Integer.valueOf, overloaded call with a primitive"
5
.
times
{
puts
Benchmark
.
measure
{
integer
=
java
.
lang
.
Integer
x
=
1
1000000
.
times
{
integer
.
valueOf
(
x
)
}
}
}
puts
"Measure ArrayList<Object>.get, non-coercible type entering Ruby"
5
.
times
{
puts
Benchmark
.
measure
{
list
=
java
.
util
.
ArrayList
.
new
list
.
add
(
java
.
lang
.
Object
.
new
)
1000000
.
times
{
list
.
get
(
0
)
}
}
}
puts
"Measure java.lang.Object.new"
5
.
times
{
puts
Benchmark
.
measure
{
1000000
.
times
{
Object
.
new
}
}
}
Back
|
FazBrowse Home
|
New Git URL