Sample
Dorn/cuda/22
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 33.7Δ 12.0 |
| Scalabrino | 0.185 | 0–1; higher is more readable | 13.2Δ 32.5 |
| Dorn | 0.221 | 0–1; higher is more readable | 18.4Δ 27.3 |
| Mi | 0.773 | 0–1; higher is more readable | 96.1Δ 50.4 |
| LLOC | 19 | Logical lines; fewer is more readable | 35.5Δ 10.2 |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs | 62.8Δ 17.1 |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs | 52.8Δ 7.1 |
| BTTF | 0.343 | 0–1; higher is more readable | 18.9Δ 26.7 |
| Human | 3.3 | 1–5; original rating | 45.7 |
Views
Select the downloaded ZIP or its extracted folder. Files stay in your browser.
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 1062.366 | −35.058 |
| Source linesThe number of non-empty source lines. | 30 | +12 |
| 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.574 | −6.861 |
Intercept 8.87 + feature contributions = -21.049 (log-odds).
Score = sigmoid(-21.049) = 0.
| Score | 0.185 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.175 | −0.755 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 29 | −0.245 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 23 | +0.222 |
| 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. | 81.935 | +0.195 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 23 | +0.058 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 29.446 | +0.002 |
Intercept 0.07 + feature contributions = -1.257 (log-odds).
Score = sigmoid(-1.257) = 0.221.
| Score | 0.773 |
|---|
| Score | 19 |
|---|
Run 1
The code is straightforward but has several readability issues. Structure is linear and mostly clear, but error handling is repetitive (multiple early returns) without cleanup of previously allocated resources. Nesting is minimal, which is good. Clarity of intent is moderate: variable names like 'count' are ambiguous (bytes? elements?) and magic numbers like 255 lack explanation. Code length is reasonable but printing every iteration is excessive for count=1000. Action granularity is mostly one action per line, though some lines combine operations (e.g., assignment and modulation). Reading flow is natural: allocate, fill, print, copy, clear, copy back, print. However, the duplicate printing loop and repetitive error checks reduce elegance. The code parses but would benefit from constants, better variable names, and consolidated error handling.
Run 2
The code is moderately readable but has several issues. Structure is linear and logical, but error handling is inconsistent — some functions check return values while 'malloc' and 'cudaMemcpy' are partially checked. Nesting is flat, which is good. Intent is somewhat clear (allocate device memory, copy data, copy back, print), but variable names like 'devPtr' and 'hostPtr' lack specificity, and magic number '255' is unexplained. Code length is reasonable but could be shorter with helper functions. Action granularity is mostly one action per line, though some lines combine multiple operations. Reading flow is interrupted by redundant fprintf loops and inconsistent spacing. The main readability issues are lack of comments, inconsistent error checking, and repetitive pointer casting.
Run 3
The code has a linear, mostly clear structure, but lacks function encapsulation and robust error handling. Nesting is minimal, but the two `fprintf` loops cause minor disorganization and verbosity. The intent (CUDA allocate, copy, verify) is apparent but uses magic numbers like `count` without context. Action granularity is mostly fine, though `cudaMalloc` and `cudaMemcpy` checks could be clearer. Uninitialized `devPtr` on failure paths and missing `cudaFree`/`free` hurt clarity and correctness. Variable declarations at the top are C-style but acceptable. Overall, it is readable for a short snippet but would benefit from helper functions and cleanup.
Run 1
Code Structure: Allocation, initialization, logging, and transfers are logically ordered, though repeated loops lack descriptive grouping. Nesting: Shallow loops and conditionals make the code easy to follow. Clarity of intent: CUDA transfer directions are explicit, but generic names, repeated pointer casts, and the unexplained count and modulo value obscure details. Code length: Reasonably concise, with some repetition in logging and buffer access. Action granularity: Most statements perform one action; loop headers conventionally combine iteration controls. Reading flow: The sequence naturally suggests a host-to-device-to-host round trip, but inconsistent braces, spacing, and blank lines interrupt visual consistency. Missing allocation checks and cleanup leave the resource lifecycle unclear.
Run 2
Code Structure: Logically sequences allocation, initialization, output, transfer, clearing, and readback, but lacks clear section boundaries. Nesting: Shallow loops and simple error checks make control flow easy to follow. Clarity of intent: CUDA calls reveal the transfer workflow, though generic names, repeated pointer casts, and no explanatory comments obscure its testing purpose. Code length: Compact overall, with some repetitive printing and initialization logic. Action granularity: Each statement performs a distinct action; loop headers conventionally combine iteration operations. Reading flow: Mostly natural and sequential, but inconsistent braces, spacing, and blank lines interrupt visual consistency.
Run 3
Code Structure: The sequence of allocation, initialization, printing, transfer, clearing, and retrieval is logically organized, though repeated printing loops could be factored out. Nesting: Shallow loops and early-return checks keep control flow simple. Clarity of intent: CUDA calls clearly show data movement, but generic names, repeated pointer casts, and no explanation of the round-trip test reduce clarity. Code length: Fairly concise, with some repetition and unnecessary whitespace. Action granularity: Each statement performs one main action, making individual steps easy to follow. Reading flow: Execution progresses naturally, but inconsistent brace usage and spacing interrupt visual consistency.