Sample

int-2774011acc98-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines40

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6480–1; higher is more readable
Dorn0.5090–1; higher is more readable
Mi0.2860–1; higher is more readable
LLOC8Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.4470–1; higher is more readable

Views

Source code

package io.netty.util; import io.netty.microbench.util.AbstractMicrobenchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import java.util.concurrent.TimeUnit; @Threads(1) @Warmup(iterations = 3) @Measurement(iterations = 3) @OutputTimeUnit(TimeUnit.MICROSECONDS) public class GetIpV6ByNameBenchmark extends AbstractMicrobenchmark { @Param({ "::", "::1234:2345", "1234:2345::3456:7890", "fe80::bdad:7a67:6fcd:fa89", "fe80:bdad:7a67:6fcd::fa89", "1234:2345:3456:4567:5678:6789:0:7890" }) private String ip; @Benchmark public byte[] getIPv6ByName() { { int startingPosition = 2; int endingPosition = 9; int travelDistance = endingPosition - startingPosition; if (travelDistance < 0) { travelDistance = -travelDistance; } } return NetUtil.getIPv6ByName(ip, true); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1155.114−38.119
Source linesThe number of non-empty source lines.40+16
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.143−7.714

Intercept 8.87 + feature contributions = -20.963 (log-odds).
Score = sigmoid(-20.963) = 0.

Score0.648

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.67.927+0.788
Indentation frequencyHow rapidly indentation changes from line to line.40+0.646
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.40−0.497
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.39−0.345
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.884+0.148
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.094+0.029

Intercept 0.07 + feature contributions = 0.036 (log-odds).
Score = sigmoid(0.036) = 0.509.

Score0.286
Score8
Run 1

The benchmark class demonstrates basic readability through its annotations and structure, but is severely compromised by an inexplicable dead-code block inside the benchmark method. This block computes travelDistance but never uses it, creating confusion about intent and violating the benchmark's purpose. The method has moderate nesting and reasonable line granularity, but the presence of irrelevant code disrupts the reading flow and raises questions about correctness. While the imports, annotations, and parameter list are clear, the core logic is obfuscated by the meaningless calculation. The code would score higher without this dead block, as the benchmark setup itself is straightforward and well-annotated. Overall score reflects the significant clarity violation despite otherwise acceptable structure.

Run 2

The code is a JMH benchmark class with clear annotations and a straightforward benchmark method, but it contains an unrelated, unexplained block of dead code inside getIPv6ByName. This block computes travelDistance and does nothing with it, creating ambiguity about intent. The structure is mostly flat and the method is short, but the presence of this irrelevant code disrupts reading flow and violates action granularity by mixing unrelated logic. The benchmarking setup is clear, but the dead code significantly undermines clarity and maintainability. Score reflects the confusion introduced by this extraneous block despite otherwise clean structure.

Run 3

The code is a JMH benchmark for IPv6 parsing. It has a clear structure with annotations and a parameterized field, and the benchmark method is concise. However, there is a significant readability issue: an unrelated block of code (variables for startingPosition, endingPosition, travelDistance) is inserted inside the benchmark method for no apparent reason. This block is not used and creates confusion about the method’s intent. It adds unnecessary nesting and distracts from the actual action (returning NetUtil.getIPv6ByName). The presence of this dead code lowers clarity of intent, action granularity, and reading flow. Removing it would make the code much clearer. Overall, the benchmark setup itself is readable, but the stray block is a major flaw.

Run 1

Code Structure: The benchmark class, annotations, and parameter list are logically organized, but an unrelated calculation block disrupts the method. Nesting: Depth is low, though the extra scope and conditional introduce unnecessary nesting. Clarity of intent: The benchmark's purpose is clear from its name and return statement; the unused travel-distance calculation has no apparent connection to IPv6 parsing. Code length: Most code is concise, but the dead calculation adds unnecessary lines. Action granularity: Each declaration, assignment, and return occupies its own line, making individual operations easy to distinguish. Reading flow: The class generally reads naturally, but inconsistent indentation in the inserted block and the lack of separation after the package declaration reduce visual consistency.

Run 2

Code Structure: The benchmark class, annotations, and parameter list are logically organized, but an unrelated calculation block disrupts the method. Nesting: Mostly shallow, although the extra scope and conditional introduce unnecessary nesting. Clarity of intent: The benchmark call clearly conveys its purpose; the unused position and distance calculations obscure that intent. Code length: The surrounding benchmark is concise, but the dead calculation adds avoidable lines. Action granularity: Each statement performs one action, making individual operations easy to parse. Reading flow: The annotations and IPv6 inputs flow naturally into the benchmark method, but inconsistent indentation and the abrupt, irrelevant block interrupt readability.

Run 3

Code Structure: The imports, benchmark configuration, parameter list, and method are logically organized, but an unrelated calculation block disrupts the method. Nesting: Depth is modest, though the extra block and conditional are unnecessary. Clarity of intent: The class name, annotations, and return statement clearly identify an IPv6 parsing benchmark; the unused travelDistance calculation has no apparent purpose. Code length: Mostly concise, but the irrelevant block adds avoidable length. Action granularity: Each declaration, assignment, and return occupies its own line, making individual operations easy to follow. Reading flow: Configuration flows naturally into the benchmark method, but inconsistent indentation and the unexplained block interrupt comprehension.