Datasets:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,50 +1,17 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
task_categories:
|
| 4 |
-
- text-generation
|
| 5 |
language:
|
| 6 |
-
- en
|
| 7 |
tags:
|
| 8 |
-
- assembly
|
| 9 |
-
- c
|
| 10 |
-
- leetcode
|
| 11 |
-
- compiler
|
| 12 |
-
- code
|
| 13 |
size_categories:
|
| 14 |
-
- 1K<n<10K
|
| 15 |
-
configs:
|
| 16 |
-
- config_name: default
|
| 17 |
-
data_files:
|
| 18 |
-
- split: train
|
| 19 |
-
path: data/train-*
|
| 20 |
-
dataset_info:
|
| 21 |
-
features:
|
| 22 |
-
- name: id
|
| 23 |
-
dtype: int64
|
| 24 |
-
- name: problem_id
|
| 25 |
-
dtype: int64
|
| 26 |
-
- name: problem_title
|
| 27 |
-
dtype: string
|
| 28 |
-
- name: difficulty
|
| 29 |
-
dtype: string
|
| 30 |
-
- name: c_source
|
| 31 |
-
dtype: string
|
| 32 |
-
- name: source_repo
|
| 33 |
-
dtype: string
|
| 34 |
-
- name: architecture
|
| 35 |
-
dtype: string
|
| 36 |
-
- name: optimization
|
| 37 |
-
dtype: string
|
| 38 |
-
- name: compiler
|
| 39 |
-
dtype: string
|
| 40 |
-
- name: assembly
|
| 41 |
-
dtype: string
|
| 42 |
-
splits:
|
| 43 |
-
- name: train
|
| 44 |
-
num_bytes: 49752046
|
| 45 |
-
num_examples: 7056
|
| 46 |
-
download_size: 8145862
|
| 47 |
-
dataset_size: 49752046
|
| 48 |
---
|
| 49 |
|
| 50 |
# LeetCode Assembly Dataset
|
|
@@ -65,10 +32,23 @@ dataset_info:
|
|
| 65 |
|
| 66 |
Each problem has **16 assembly variants** (4 architectures x 4 optimization levels), making this useful for studying how the same algorithm compiles differently across ISAs and optimization settings.
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
## Schema
|
| 69 |
|
| 70 |
| Column | Type | Description |
|
| 71 |
|--------|------|-------------|
|
|
|
|
| 72 |
| `problem_id` | int | LeetCode problem number |
|
| 73 |
| `problem_title` | string | Problem name (e.g. "Two Sum") |
|
| 74 |
| `difficulty` | string | Easy, Medium, or Hard |
|
|
@@ -78,7 +58,6 @@ Each problem has **16 assembly variants** (4 architectures x 4 optimization leve
|
|
| 78 |
| `optimization` | string | GCC optimization flag: `-O0`, `-O1`, `-O2`, `-O3` |
|
| 79 |
| `compiler` | string | Compiler version used |
|
| 80 |
| `assembly` | string | Compiled assembly output |
|
| 81 |
-
| `compilation_success` | bool | Whether compilation succeeded |
|
| 82 |
|
| 83 |
## Usage
|
| 84 |
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
language:
|
| 6 |
+
- en
|
| 7 |
tags:
|
| 8 |
+
- assembly
|
| 9 |
+
- c
|
| 10 |
+
- leetcode
|
| 11 |
+
- compiler
|
| 12 |
+
- code
|
| 13 |
size_categories:
|
| 14 |
+
- 1K<n<10K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
# LeetCode Assembly Dataset
|
|
|
|
| 32 |
|
| 33 |
Each problem has **16 assembly variants** (4 architectures x 4 optimization levels), making this useful for studying how the same algorithm compiles differently across ISAs and optimization settings.
|
| 34 |
|
| 35 |
+
## Key Insights
|
| 36 |
+
|
| 37 |
+
- The dataset contains **1.48 million lines** of assembly (34.9M characters) across 7,056 rows.
|
| 38 |
+
- **-O3 often produces more code than -O0**, not less. Across all architectures, -O3 output is 37-73% larger on average due to aggressive inlining and loop unrolling.
|
| 39 |
+
- **-O1 consistently produces the most compact assembly** across all four architectures.
|
| 40 |
+
- **Recursive tree problems see extreme -O3 blowup.** The top 10 largest O3-vs-O0 ratios are all binary tree problems. Worst case: Longest Univalue Path goes from 90 lines (O0) to 3,809 lines (O3) -- a 42x increase.
|
| 41 |
+
- **Iterative and math problems shrink dramatically at -O3.** Flip String to Monotone Increasing drops from 89 to 8 lines (91% reduction). Nim Game compiles down to just 4 lines.
|
| 42 |
+
- **AArch64 produces the most compact assembly at -O2** (avg 153 lines), followed by x86-64 (170), RISC-V (170), and MIPS64 (236). MIPS is 39% more verbose than AArch64.
|
| 43 |
+
- **Hard problems produce 2x more assembly than Easy problems** at -O2 on x86-64 (247 vs 121 avg lines). Algorithmic complexity maps directly to code size.
|
| 44 |
+
- **The largest output is LFU Cache** (1,121 lines at -O0 on x86-64), a complex doubly-linked list plus hash table implementation.
|
| 45 |
+
- **The smallest output is Nim Game at -O3** (4 lines on x86-64) -- the entire solution optimizes to a single bitwise AND.
|
| 46 |
+
|
| 47 |
## Schema
|
| 48 |
|
| 49 |
| Column | Type | Description |
|
| 50 |
|--------|------|-------------|
|
| 51 |
+
| `id` | int | Unique row identifier (0-7055) |
|
| 52 |
| `problem_id` | int | LeetCode problem number |
|
| 53 |
| `problem_title` | string | Problem name (e.g. "Two Sum") |
|
| 54 |
| `difficulty` | string | Easy, Medium, or Hard |
|
|
|
|
| 58 |
| `optimization` | string | GCC optimization flag: `-O0`, `-O1`, `-O2`, `-O3` |
|
| 59 |
| `compiler` | string | Compiler version used |
|
| 60 |
| `assembly` | string | Compiled assembly output |
|
|
|
|
| 61 |
|
| 62 |
## Usage
|
| 63 |
|