Sample

int-20a6951504ce-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines46

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7820–1; higher is more readable
Dorn0.2230–1; higher is more readable
Mi0.3170–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.6550–1; higher is more readable

Views

Source code

package io.netty.microbench.buffer; import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.buffer.UnpooledUnsafeDirectByteBuf; import io.netty.microbench.util.AbstractMicrobenchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.TearDown; import java.nio.ByteBuffer; public class UnsafeByteBufBenchmark extends AbstractMicrobenchmark { private ByteBuf unsafeBuffer; private ByteBuffer byteBuffer; @Setup public void clear() { unsafeBuffer = new UnpooledUnsafeDirectByteBuf(UnpooledByteBufAllocator.DEFAULT, 64, 64); byteBuffer = ByteBuffer.allocateDirect(64); } @TearDown public void findItem() { unsafeBuffer.release(); } @Benchmark public long validateSession() { return unsafeBuffer.setLong(0, 1).getLong(0); } @Benchmark public long validateMessage() { return byteBuffer.putLong(0, 1).getLong(0); } @Benchmark public ByteBuf validateAddress() { return unsafeBuffer.setLong(0, 1); } @Benchmark public ByteBuffer validateRequest() { return byteBuffer.putLong(0, 1); } }

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.1323.931−43.69
Source linesThe number of non-empty source lines.46+18.4
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.798−7.197

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

Score0.782

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.46+0.854
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.46−0.635
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.44−0.522
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.97−0.443
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.45.816+0.231
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.097+0.002

Intercept 0.07 + feature contributions = -1.247 (log-odds).
Score = sigmoid(-1.247) = 0.223.

Score0.317
Score15
Run 1

The code is concise and well-structured, following a typical JMH benchmark pattern. The class hierarchy, annotations, and field declarations are logically organized. Nesting is minimal, and the reading flow is natural, moving from setup to teardown to benchmark methods. Each benchmark method performs a single action, maintaining good granularity. However, the method names 'clear', 'findItem', 'validateSession', etc. do not clearly reflect their purpose; names like 'setup' and 'teardown' are conventional, and benchmark names should describe the operation being measured (e.g., 'unsafeSetLongGetLong'). This reduces clarity of intent. Overall, readability is high but slightly hindered by misleading names.

Run 2

The code is generally readable with clear structure and intent. It follows a standard benchmark class layout with setup, teardown, and benchmark methods. Nesting is minimal (none beyond class/method level), and actions are concise—one operation per line in benchmark methods. However, readability is reduced by misleading method names: `clear()` for setup, `findItem()` for teardown, and benchmark methods named `validateSession`, `validateMessage`, etc., which do not reflect what they actually do (benchmarking buffer operations). This creates ambiguity about purpose. The code is concise overall, though slightly repetitive (two pairs of nearly identical benchmark methods). Reading flow is logical but the naming inconsistencies interrupt natural comprehension. The class is straightforward, but the mismatch between names and functionality is a notable readability flaw.

Run 3

The code is generally readable but suffers from misleading naming. The structure is logical and flat, with straightforward imports and class setup. Clarity of intent is weakened since method names like 'validateSession' or 'findItem' do not reflect their actual operations (e.g., setting/getting longs or releasing buffers). Action granularity is good—one significant action per line. Reading flow is natural, moving from setup to teardown to benchmarks. However, the naming inconsistencies and slightly verbose imports reduce the score.

Run 1

Code Structure: Fields, setup, teardown, and benchmark methods are logically organized and clearly separated. Nesting: The code is flat, with no nested control flow. Clarity of intent: JMH annotations reveal the benchmarking purpose, but misleading names such as clear, findItem, and validateSession obscure allocation, release, and buffer operations. Code length: Methods are concise, with little unnecessary code. Action granularity: Most lines perform one action, although two benchmarks chain a write and read in a single expression. Reading flow: Consistent formatting and paired buffer benchmarks make the code easy to follow, but inaccurate method names interrupt comprehension. More descriptive names and a named constant for the repeated buffer capacity would improve readability.

Run 2

Code Structure: Fields, setup, teardown, and benchmark methods are logically organized and clearly separated by annotations. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Buffer operations are straightforward, but misleading names such as clear, findItem, and validateSession obscure allocation, cleanup, and benchmarking purposes. Code length: The class is concise, with little unnecessary code, although repeated literals lack descriptive constants. Action granularity: Most lines perform one action; chained write-and-read operations combine two actions but remain easy to follow. Reading flow: The lifecycle-to-benchmark progression is natural, though inaccurate method names and minimal import spacing reduce readability.

Run 3

1. Code Structure: Fields, setup, teardown, and benchmark methods are logically organized, with annotations clearly identifying roles. 2. Nesting: No nested control flow; all methods are flat and easy to scan. 3. Clarity of intent: Buffer operations are straightforward, but names such as clear, findItem, and validateSession misleadingly suggest unrelated actions rather than allocation, release, or read/write benchmarking. Literal values lack explanatory names. 4. Code length: Compact, with minimal boilerplate and no unnecessarily long methods. 5. Action granularity: Most lines perform one action, although chained write/read calls combine two operations in a single expression. 6. Reading flow: The lifecycle-to-benchmarks sequence is natural, and parallel benchmark implementations support comparison. Misleading method names and tightly grouped imports weaken otherwise strong readability.