Sample

int-41bafec65ffc-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines61

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.80–1; higher is more readable
Dorn0.750–1; higher is more readable
Mi0.0440–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.670–1; higher is more readable

Views

Source code

package io.netty.channel.uring; final class RingBuffer { private final SubmissionQueue ioUringSubmissionQueue; private final CompletionQueue ioUringCompletionQueue; private final int features; private boolean closed; RingBuffer(SubmissionQueue ioUringSubmissionQueue, CompletionQueue ioUringCompletionQueue, int features) { this.ioUringSubmissionQueue = ioUringSubmissionQueue; this.ioUringCompletionQueue = ioUringCompletionQueue; this.features = features; } /** * Enable ring. This method must be called from the same method that will call {@link SubmissionQueue#submit()} and * {@link SubmissionQueue#submitAndWait()}. */ void enable() { // We create our ring in disabled mode and so need to enable it first. Native.ioUringRegisterEnableRings(fd()); // Now also register the ring filedescriptor itself. This needs to happen in the same thread // that will also call the io_uring_enter(...) ioUringSubmissionQueue.tryRegisterRingFd(); } int fd() { return ioUringCompletionQueue.ringFd; } int features() { return features; } SubmissionQueue ioUringSubmissionQueue() { return this.ioUringSubmissionQueue; } CompletionQueue ioUringCompletionQueue() { return this.ioUringCompletionQueue; } void close() { if (closed) { return; } closed = true; ioUringSubmissionQueue.close(); ioUringCompletionQueue.close(); Native.ioUringExit( ioUringSubmissionQueue.submissionQueueArrayAddress(), ioUringSubmissionQueue.ringEntries, ioUringSubmissionQueue.ringAddress, ioUringSubmissionQueue.ringSize, ioUringCompletionQueue.ringAddress, ioUringCompletionQueue.ringSize, ioUringSubmissionQueue.ringFd, ioUringSubmissionQueue.enterRingFd); } }

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.1063.548−35.097
Source linesThe number of non-empty source lines.61+24.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.357−6.535

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

Score0.8

Feature contributions

FeatureValueContribution
(log-odds)
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.118.968−1.374
Indentation frequencyHow rapidly indentation changes from line to line.55+1.165
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.62−1.159
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.119+1.116
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.60.9+0.441
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.052+0.439
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398

Intercept 0.07 + feature contributions = 1.096 (log-odds).
Score = sigmoid(1.096) = 0.75.

Score0.044
Score26
Run 1

The code is generally well-organized with clear method separation and consistent naming. The class structure is logical, grouping related io_uring functionality. Nesting is minimal with only one early return in close(). Intent is mostly clear, though the relationship between submission/completion queues and feature flags could benefit from more documentation. Code length is reasonable - methods are concise and focused. Action granularity is good, with one main operation per line in most cases. Reading flow is natural with methods ordered logically (construction, enable, accessors, close). Minor issues include the constructor not validating parameters, slightly verbose variable names (ioUringSubmissionQueue repeated throughout), and the close() method's multi-line Native.ioUringExit call which reduces readability. The enable() method's comments are helpful but could be more explanatory. Overall, solid code that would be understandable to developers familiar with io_uring.

Run 2

The code is generally readable with clear intent and logical organization. Class structure follows a simple constructor/getter pattern. Nesting is minimal, with only a single early-return guard in close(). Method names clearly convey purpose. However, readability suffers from very long field names like `ioUringSubmissionQueue` repeated throughout, and the `close()` method contains a long Native call with many arguments spanning multiple lines. The Javadoc comments are helpful but slightly verbose. Overall, the code is well-structured but could benefit from shorter local variable names or helper methods to reduce repetition and improve flow.

Run 3

The code is generally well-structured and readable. It uses clear method names, logical organization, and keeps methods concise with minimal nesting. The class has a single responsibility (managing the ring buffer), and field names clearly indicate their purpose. The `close()` method has a simple guard clause, keeping nesting flat. However, the `close()` method's final call to `Native.ioUringExit` is quite long and passes many arguments on multiple lines, which slightly reduces readability due to the density of arguments. The comments provide useful context but could be more concise. Overall, the code is clear but loses points for the verbose native call and slightly repetitive getter methods.

Run 1

Code Structure: Fields, constructor, lifecycle methods, and accessors are logically organized with clear separation of responsibilities. Nesting: Minimal; close() uses an early return to keep cleanup flat. Clarity of intent: Descriptive names and comments explain ring initialization and cleanup, although enable() documentation says 'same method' while its comment specifies 'same thread', creating ambiguity. Code length: Concise, with little unnecessary code; repeated long queue names add some visual weight. Action granularity: Each statement performs a distinct action, and the native cleanup arguments are individually formatted. Reading flow: Natural and straightforward, though the long positional argument list in Native.ioUringExit requires knowledge of the native API to interpret confidently.

Run 2

Code Structure: Fields, constructor, lifecycle methods, and accessors are logically organized with clearly separated responsibilities. Nesting: Almost entirely flat; close() uses a simple guard clause. Clarity of intent: Descriptive queue names and comments explain initialization requirements, although fd() is abbreviated and the enable() documentation says 'same method' where the inline comment specifies 'same thread.' Code length: Compact and appropriate, with little unnecessary code. Action granularity: Each statement performs one distinct action; the multiline native call remains readable. Reading flow: Execution proceeds naturally through enabling and cleanup, though the long positional argument list in ioUringExit requires careful reading to distinguish similar queue addresses and sizes.

Run 3

Code Structure: Fields, constructor, lifecycle methods, and accessors are logically organized in a focused class. Nesting: Minimal nesting; close() uses an early return to keep cleanup flat. Clarity of intent: Descriptive queue names and explanatory comments make responsibilities clear, although fd() is abbreviated and enable() documentation says 'same method' where the comment specifies 'same thread.' Code length: Concise, with little unnecessary code; long queue identifiers add some visual weight. Action granularity: Each statement performs a single clear action, and the native exit arguments are separated onto individual lines. Reading flow: Initialization, enabling, access, and cleanup follow a natural progression. The lengthy positional argument list in Native.ioUringExit requires extra effort to understand.