Sample

int-959d682a999f-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines39

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6740–1; higher is more readable
Dorn0.3930–1; higher is more readable
Mi0.0130–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro5.330–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.5780–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.39+15.6
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.485−6.728

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

Score0.674

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.165−3.324
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.165+1.858
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.055+0.406
Indentation frequencyHow rapidly indentation changes from line to line.33+0.404
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.40−0.38
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.38.922+0.134

Intercept 0.07 + feature contributions = -0.434 (log-odds).
Score = sigmoid(-0.434) = 0.393.

Score0.013
Score26
Run 1

The code is difficult to read due to poor structure and formatting. Multiple statements are crammed onto single lines, making it hard to follow the logical flow. The class has no vertical separation between fields and methods, and some methods like `close()` mix conditionals, assignments, and method calls on one line. The `RingBuffer` constructor places multiple assignments on the same line, reducing clarity. Action granularity is poor—several operations occur per line, violating the one-action-per-line guideline. Nesting is minimal, which is positive, but the lack of line breaks undermines readability. Intent is partially discernible from comments, but the dense formatting obscures the code's purpose. Reading flow is disorganized because related statements are not grouped visually. Overall, the code needs reformatting with consistent line breaks, better spacing, and separation of concerns to improve readability.

Run 2

The code suffers from extremely poor formatting and organization. Multiple statements are crammed onto single lines, making it difficult to follow the logical flow. The constructor and methods like fd(), features(), and the accessor methods are all collapsed into dense one-liners. Intent is somewhat clear - it is a Netty ring buffer wrapper - but the presentation obscures it. Nesting is minimal, which helps, but action granularity is violated severely, as many actions occur per line. Reading flow is unnatural because the eye must parse packed statements. Code length could be reasonable if properly formatted, but the compression hurts readability. Overall, the logical structure exists but is buried under bad layout, so the score is low.

Run 3

The code has several readability issues. Multiple statements are crammed onto single lines (e.g., field declarations, constructor body, getter methods, close method), violating the 'one action per line' principle. The class mixes field declarations, constructor, and methods without clear visual separation. The close method combines multiple operations on one line, making it hard to follow. While the enable method is relatively clear due to its comments, the overall structure feels compressed and disorganized. The code would benefit from proper line breaks, spacing between methods, and consistent formatting. The intent is somewhat clear from method names, but the presentation significantly hampers readability.

Run 1

Code Structure: Fields, constructor, accessors, initialization, and cleanup are logically grouped, but compressed formatting blurs their boundaries. Nesting: Minimal nesting and an early return keep control flow simple. Clarity of intent: Descriptive names and comments clarify ring setup and cleanup, though the native exit call requires domain knowledge. Code length: Appropriately short, with little unnecessary code; excessive compression reduces readability rather than improving concision. Action granularity: Multiple declarations, assignments, method definitions, and cleanup operations share lines, making individual actions harder to scan. Reading flow: The overall sequence is natural, but inconsistent line breaks and methods beginning immediately after closing braces interrupt reading.

Run 2

Code Structure: The class logically groups state, initialization, accessors, and cleanup, but compressed formatting obscures method boundaries. Nesting: Minimal nesting and an early return keep control flow simple. Clarity of intent: Descriptive queue names and comments explain ring enabling; cleanup intent is clear, though the long positional native call requires careful reading. Code length: Appropriately concise for a small wrapper, but excessive line compression sacrifices readability. Action granularity: Multiple field declarations, assignments, method definitions, and cleanup calls share lines, making individual actions harder to distinguish. Reading flow: The overall sequence is natural, but inconsistent line breaks, inline braces, and crowded accessors interrupt scanning.

Run 3

Code Structure: Fields, constructor, accessors, and lifecycle methods are logically organized, but compressed formatting obscures their boundaries. Nesting: Minimal nesting and an early return keep control flow simple. Clarity of intent: Descriptive names and comments explain ring initialization and cleanup, although the enable() documentation says 'same method' while its comment says 'same thread,' creating ambiguity. Code length: The class is concise with little unnecessary code, though long identifiers and the lengthy native call require careful scanning. Action granularity: Multiple declarations, assignments, method definitions, and cleanup calls share lines, reducing readability. Reading flow: The overall sequence is natural, but inconsistent line breaks, crowded braces, and uneven argument formatting interrupt scanning.