Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 000b993

Browse files
committed
Slight improvements to the documentation
1 parent bf33e28 commit 000b993

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Readme.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ http://oracl.info/xu1B50ypCAU
1111
image::doc/ERb3bnYX0AACSXK.png[]
1212
____
1313
While this does of course work, it may not be the best solution (both in terms of readability and in terms of performance).
14-
Other suggestions were:
14+
15+
Other suggestions made in the replies were:
1516

1617
.Suggestion by https://twitter.com/colmaclean::[Colin MacLean] in https://twitter.com/colmaclean/status/1231486166173614080:[this tweet]
1718
[source, java]
@@ -151,15 +152,16 @@ Or, to quote Martin Fowler:
151152
____
152153
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
153154
____
154-
This microbenchmark suite can not measure readability.
155155

156-
Here again are the three implementations:
156+
This microbenchmark suite can not (and does not try to) measure readability, in part because this is subjective.
157+
However, here are my thoughts on the three implementations.
157158

158159
.The original suggestion using Streams
159160
[source, java]
160161
----
161162
include::src/main/java/com/github/blalasaadri/MyBenchmark.java[tag=streams, indent=0]
162163
----
164+
163165
This has a total of 4 lines of code (not counting the empty line).
164166
To understand what it's doing, you have to understand how the stream is created, which and how many elements are contained in that stream, how the mapping works and how the collection works.
165167

@@ -168,6 +170,7 @@ To understand what it's doing, you have to understand how the stream is created,
168170
----
169171
include::src/main/java/com/github/blalasaadri/MyBenchmark.java[tag=enhanced_for, indent=0]
170172
----
173+
171174
This also has a total of 4 lines of code.
172175
To understand what it's doing, you have to understand how an https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14.2:[enhanced for loop]footnote:[also sometimes called a _for each loop_] works and when the index is incremented for `i++`.
173176

@@ -176,6 +179,7 @@ To understand what it's doing, you have to understand how an https://docs.oracle
176179
----
177180
include::src/main/java/com/github/blalasaadri/MyBenchmark.java[tag=old_school_for, indent=0]
178181
----
182+
179183
This has a total of 3 lines of code.
180184
To understand what it's doing, you have to understand how a https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14.1:[basic for loop] works and when the index is incremented for `i++`.
181185

0 commit comments

Comments
 (0)