Sample
Dorn/cuda/39
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 55.4Δ 15.3 |
| Scalabrino | 0.829 | 0–1; higher is more readable | 89.9Δ 19.2 |
| Dorn | 0.652 | 0–1; higher is more readable | 58.8Δ 12.0 |
| Mi | 0.643 | 0–1; higher is more readable | 71.9Δ 1.1 |
| LLOC | 12 | Logical lines; fewer is more readable | 53.6Δ 17.1 |
| DeepSeek V4 Pro | 11.33 | 0–20; mean of three runs | 49.3Δ 21.4 |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs | 52.8Δ 18.0 |
| BTTF | 0.359 | 0–1; higher is more readable | 20.3Δ 50.4 |
| Human | 3.6 | 1–5; original rating | 70.8 |
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. | 660.591 | −21.8 |
| 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.969 | −7.454 |
Intercept 8.87 + feature contributions = -8.383 (log-odds).
Score = sigmoid(-8.383) = 0.
| Score | 0.829 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 83.968 | +0.55 |
| 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. | 83.935 | +0.11 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 19 | −0.08 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 20 | −0.038 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.093 | +0.037 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 29.753 | +0.006 |
Intercept 0.07 + feature contributions = 0.63 (log-odds).
Score = sigmoid(0.63) = 0.652.
| Score | 0.643 |
|---|
| Score | 12 |
|---|
Run 1
The code is moderately readable but has several issues. The structure is logical for a CUDA memory transfer operation, but the presence of large commented-out blocks disrupts the reading flow. Nesting is flat and manageable. Clarity of intent is somewhat reduced by the commented-out `mlock`/`munlock` code, which creates ambiguity about whether the feature is intentionally disabled or temporarily removed. Code length is reasonable, though the commented blocks inflate it unnecessarily. Action granularity is mostly one action per line, which is good, but error-handling returns are repetitive and could be consolidated. The loop `((uint8_t*)hostPtr)[i] = (i % 126) + 1;` is compact but lacks explanation. Overall, the core logic is understandable, but messy commented sections and mixed formatting detract from readability.
Run 2
The code is generally linear and readable, but has several issues. The commented-out mlock/munlock blocks are confusing and add visual clutter. Variable declarations are interleaved with logic (void* devPtr declared mid-function), and error messages are repetitive. The single-line for loop and brace-less if statements reduce clarity. Multiple operations (memcpy calls, error handling) are packed together without separation. One action per line is inconsistently applied, and nesting is shallow but error handling branches feel repetitive. The intent is reasonably clear, but overall readability suffers from poor organization and unnecessary comments.
Run 3
The code has basic logical separation of memory operations, but several issues hurt readability. It starts with a clear NULL check, but the initialization loop is overly compact. Large blocks of commented-out code disrupt the reading flow and add clutter. The CUDA error handling is inconsistent: cudaMalloc is checked, but cudaMemcpy calls are not, leaving ambiguity about error expectations. Action granularity varies—some lines perform one action while others combine initialization and assignment. The variable naming is generic (hostPtr, backPtr, devPtr) with no indication of their relationship. The code lacks comments explaining intent, and the overall structure feels fragmented due to the commented sections creating visual noise. Reading flow is disrupted by the comment blocks placed mid-logic.
Run 1
Code Structure: The sequence is logically organized: validate pointers, initialize host data, allocate device memory, transfer data, and free host memory. Commented-out pinning blocks add clutter. Nesting: Shallow conditionals and a single loop make the code easy to follow, though braces around the loop would improve consistency. Clarity of intent: CUDA calls clearly convey the transfer process, but generic pointer names and the unexplained initialization formula reduce clarity. Code length: The active code is concise; disabled code and unnecessary blank lines lengthen it without improving understanding. Action granularity: Each statement performs one primary action, with error reporting and returns on separate lines. Reading flow: Execution follows a natural order, but inconsistent spacing, repeated casts, and commented-out sections interrupt the flow.
Run 2
Code Structure: Logically organized into allocation checks, initialization, device allocation, transfers, and cleanup, though commented-out memory-pinning blocks add clutter. Nesting: Shallow conditionals and a single loop make the code easy to follow. Clarity of intent: CUDA calls and error messages communicate the purpose, but abbreviated pointer names and the unexplained initialization formula reduce clarity. Code length: Mostly concise, with unnecessary commented-out code and casts adding visual noise. Action granularity: Each statement performs one clear action, and error handling is separated into readable lines. Reading flow: The sequence is natural, but inconsistent spacing, extra blank lines, and the unbraced loop interrupt visual consistency.
Run 3
Code Structure: The snippet follows logical stages: validate allocations, initialize host data, allocate device memory, copy data, and free host memory. Commented-out memory-pinning blocks add clutter. Nesting: Shallow conditionals and a single loop keep complexity low. Clarity of intent: CUDA calls and error messages make the transfer sequence understandable, but generic pointer names and an unexplained initialization pattern weaken clarity. Code length: The active code is concise, though disabled blocks and extra whitespace unnecessarily lengthen it. Action granularity: Statements generally perform one action per line. Reading flow: Execution proceeds naturally, but inconsistent formatting, a brace-free loop, and inline casts interrupt readability.