FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/java/ql/src/Performance/ConcatenationInLoops.java at main · github/codeql · GitHub
github
codeql
Repository navigation
Code
Issues
1k
(1k)
Pull requests
477
(477)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Performance
/
ConcatenationInLoops.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
18 lines (17 loc) · 580 Bytes
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Performance
/
ConcatenationInLoops.java
Copy path
File metadata and controls
18 lines (17 loc) · 580 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
17
18
public
class
ConcatenationInLoops
{
public
static
void
main
(
String
[]
args
) {
Random
r
=
new
Random
(
123
);
long
start
=
System
.
currentTimeMillis
();
String
s
=
""
;
for
(
int
i
=
0
;
i
<
65536
;
i
++)
s
+=
r
.
nextInt
(
2
);
System
.
out
.
println
(
System
.
currentTimeMillis
() -
start
);
// This prints roughly 4500.
r
=
new
Random
(
123
);
start
=
System
.
currentTimeMillis
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
65536
;
i
++)
sb
.
append
(
r
.
nextInt
(
2
));
s
=
sb
.
toString
();
System
.
out
.
println
(
System
.
currentTimeMillis
() -
start
);
// This prints 5.
}
}
Back
|
FazBrowse Home
|
New Git URL