Skip to content
dongsheng123132Public

About

๐Ÿ”ฅ UBench โ€” ่กŒไธšๆ ‡ๅ‡† USB ่ท‘ๅˆ†ๅทฅๅ…ท๏ผš็ป•่ฟ‡ OS ็ผ“ๅญ˜็š„ Direct I/O ็œŸๅฎž้€Ÿๅบฆๆต‹้‡๏ผŒ่ฏ†ๅˆซๅ‡็›˜ๆ‰ฉๅฎน็›˜๏ผŒๅ…ผๅฎน CrystalDiskMark ไธŽ AS SSD ่พ“ๅ‡บใ€‚Rust CLI, Windows ๅฏ็”จใ€‚

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

UBench โ€” USB Flash Drive & Portable SSD Benchmark

The industry standard for honest USB benchmarking with Direct I/O. Bypasses OS cache to give you the real flash speed โ€” not RAM speed.

ๅ…จ็ƒ้ฆ–ไธช็ป•่ฟ‡ OS ็ผ“ๅญ˜็š„ U ็›˜ / ็งปๅŠจๅ›บๆ€็กฌ็›˜่ท‘ๅˆ†่กŒไธšๆ ‡ๅ‡†ใ€‚่ฏ†ๅˆซๆ‰ฉๅฎนๅ‡็›˜ใ€ๆต‹้‡็œŸๅฎž้€Ÿๅบฆใ€ๅฏนๆ ‡ CrystalDiskMark / AS SSD Benchmarkใ€‚

License: MIT Spec Platform Rust

UBench ็œŸๅฎž่ท‘ๅˆ†่พ“ๅ‡บ โ€” ็ป•่ฟ‡ OS ็ผ“ๅญ˜็š„ Direct I/O ๆต‹้€Ÿ๏ผŒๅฎžๆต‹ NVMe SSD ้กบๅบ่ฏป 2143 MB/sใ€UBench Score 95/100 A ็บง

Keywords: USB benchmark ยท USB speed test ยท CrystalDiskMark alternative ยท AS SSD Benchmark ยท fake USB detection ยท portable SSD test ยท 4K random IOPS ยท Direct I/O ยท NO_BUFFERING ยท U็›˜่ท‘ๅˆ† ยท U็›˜ๆต‹้€Ÿ ยท ๅ‡U็›˜ๆฃ€ๆต‹ ยท ๆ‰ฉๅฎน็›˜่ฏ†ๅˆซ ยท ็งปๅŠจๅ›บๆ€ๆต‹่ฏ• ยท ่กŒไธšๆ ‡ๅ‡†


Why UBench?

Every existing USB drive benchmark โ€” CrystalDiskMark, ATTO, HD Tune โ€” is lying to you.

They show your USB flash drive doing 5,000 MB/s reads and 120,000 IOPS because they measure the OS file cache (RAM speed), not the actual flash. The numbers are physically impossible: USB 2.0 tops out at 35 MB/s, USB 3.2 Gen 2 at 1.2 GB/s.

UBench bypasses the OS cache entirely (using FILE_FLAG_NO_BUFFERING on Windows, F_NOCACHE on macOS โ€” the same technique Microsoft DiskSpd uses) and reports the real speed your drive can deliver.

Real-world example

Same drive, same machine, same minute:

Tool SEQ1M Read RND4K Read What it actually measured
Naive benchmark 5,610 MB/s 120,169 IOPS RAM speed (OS cache)
UBench 467 MB/s 359 IOPS The actual USB flash chip

The naive number was inflated 335ร— for 4K random reads. That's why your "fast USB 3.0 drive" feels like garbage when you put 10,000 small files on it.


Quick Start

Install

git clone https://github.com/dongsheng123132/ubench
cd ubench
cargo build --release
# Binary at: target/release/ubench

Requires Rust 1.70+.

Benchmark a drive

# Quick profile (~1 minute, 4 core tests)
ubench bench E:\ --quick

# Full profile (~10 minutes, 6 tests including SLC-cache exhaustion + cold-start latency)
ubench bench E:\ --full

# Save signed JSON report (uploadable to udiskbench.org)
ubench bench E:\ --quick --out my-drive.json

# JSON output to stdout (for AI tools / CI)
ubench bench E:\ --quick --json

Sample output

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  UBench v1.0.0 โ€” ่กŒไธšๆ ‡ๅ‡† U็›˜่ท‘ๅˆ†                              โ•‘
โ•‘  ็ป•่ฟ‡ OS ็ผ“ๅญ˜็š„็œŸๅฎž้€Ÿๅบฆๆต‹้‡ (Direct I/O)                         โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  ็›ฎๆ ‡็›˜     : E:\
  ๆต‹่ฏ•ๆจกๅผ   : QUICK (~1 ๅˆ†้’Ÿ,4 ้กน)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๆต‹่ฏ•้กน           โ”† ไธญไฝๆ•ฐ      โ”† ๆœ€ๅฐ   โ”† ๆœ€ๅคง   โ”† ็จณๅฎšๆ€ง โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚ SEQ1M Q1T1 Write โ”† 426.6 MB/s  โ”† 423.5  โ”† 426.6  โ”† 0.4%   โ”‚
โ”‚ SEQ1M Q1T1 Read  โ”† 478.5 MB/s  โ”† 467.4  โ”† 478.5  โ”† 1.2%   โ”‚
โ”‚ RND4K Q1T1 Write โ”† 4630.4 IOPS โ”† 4297.4 โ”† 4630.4 โ”† 3.7%   โ”‚
โ”‚ RND4K Q1T1 Read  โ”† 4214.8 IOPS โ”† 4157.6 โ”† 4214.8 โ”† 0.7%   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  โ–ถโ–ถ  UBench Score (UBS): 88 / 100
  โ–ถโ–ถ  Grade            : A (Excellent)
  ็ญพๅ: sha256:e8971c0e0e2307edf151281a0df2586f

What Makes UBench Different

UBench CrystalDiskMark ATTO Naive Tools
Bypasses OS cache โœ… Direct I/O โœ… (DiskSpd) โŒ โŒ
Detects fake capacity โœ… โŒ โŒ โŒ
Tests SLC cache exhaustion โœ… 60s sustained โŒ โŒ โŒ
USB-tuned workload (Q1) โœ… โŒ tests Q32 partial โŒ
Reproducible across runs โœ… seeded PRNG โš ๏ธ โŒ โŒ
Cryptographically signed โœ… SHA-256 โŒ โŒ โŒ
CLI / scriptable โœ… --json โŒ GUI only โŒ GUI only mixed
Open spec โœ… SPEC.md partial โŒ โŒ
License MIT freeware freeware various

UBench Score (UBS)

A single 0-100 number summarizing the drive. See SPEC.md ยง4 for the full formula.

UBS Grade Verdict
85-100 A Excellent Premium drive, suitable for OS / heavy workload
70-84 B Good Daily driver
50-69 C Acceptable Document storage only
25-49 D Poor Painful for many small files
0-24 F Garbage Likely fake or damaged

Weights (RND4K Read carries the most weight โ€” 35% โ€” because that's what determines whether your drive feels fast or slow in real life):

RND4K Read   35%  โ† The bottleneck for "many small files" workloads
RND4K Write  25%
SEQ1M Write  15%
SEQ1M Read   10%
Sustained60s 10%  (Full profile only)
ColdStartRead 5%  (Full profile only)

The Industry Standard

UBench v1.0 is open and free for anyone to implement. The full specification is in SPEC.md.

If you build a competing implementation that follows the spec, your scores will be directly comparable to ours. That's the entire point.

The signed JSON report format is stable across UBench v1.x. We're building udiskbench.org (coming soon) for crowd-sourced drive rankings.


Architecture

Pure Rust CLI, no GUI dependencies, single binary.

src/
โ”œโ”€โ”€ main.rs              # Entry: tokio runtime + Ctrl+C handler
โ”œโ”€โ”€ lib.rs               # Module declarations + STOP_FLAG
โ”œโ”€โ”€ direct_io.rs         # โ˜… The core: Win32 NO_BUFFERING + macOS F_NOCACHE
โ”œโ”€โ”€ bench/
โ”‚   โ”œโ”€โ”€ profile.rs       # Quick / Full test profiles (the spec)
โ”‚   โ”œโ”€โ”€ runner.rs        # Time-windowed test execution
โ”‚   โ”œโ”€โ”€ score.rs         # Logarithmic UBS scoring formula
โ”‚   โ””โ”€โ”€ report.rs        # Signed JSON report (SHA-256)
โ”œโ”€โ”€ disk/                # Drive detection (Windows: WMI, macOS: diskutil)
โ”œโ”€โ”€ test/                # Legacy quality tests (capacity, badblock, thermal)
โ”œโ”€โ”€ cli/                 # Command-line interface
โ”œโ”€โ”€ report/              # HTML report generation
โ””โ”€โ”€ db.rs                # SQLite report history

License

MIT. Use it, fork it, build a startup on top of it. Just don't claim "UBench-compliant" if you broke the spec.


Contributing

Issues and PRs welcome at https://github.com/dongsheng123132/ubench

The spec (SPEC.md) is the source of truth. If a measurement disagrees with the spec, the measurement is wrong, not the spec.


Acknowledgments

  • Microsoft DiskSpd team โ€” for proving direct I/O is the right way
  • CrystalDiskMark โ€” for popularizing benchmarking; UBench started by reading its source
  • The U-Claw project โ€” the workload that made it obvious how broken existing benchmarks are

FAQ / ๅธธ่ง้—ฎ้ข˜

How do I detect a fake-capacity USB drive? / ๆ€Žไนˆๆฃ€ๆต‹ๆ‰ฉๅฎนๅ‡U็›˜๏ผŸ

Run ubench test E:\ --capacity for a full write-verify scan across the drive. Any block that reads back with the wrong identifier proves capacity is fake. ่ท‘ๅฎน้‡้ชŒ่ฏๅ‘ฝไปค,ๅฆ‚ๆžœๅ›ž่ฏปๆ•ฐๆฎๆœ‰้”™ไฝๅฐฑๆ˜ฏๆ‰ฉๅฎนๅ‡็›˜ใ€‚

Why does my USB drive show 5000+ MB/s in CrystalDiskMark but only 400 MB/s in UBench? / ไธบไป€ไนˆ CrystalDiskMark ๆต‹ๅ‡บ 5000+ MB/s ไฝ† UBench ๅชๆœ‰ 400 MB/s?

Because CrystalDiskMark's default settings can hit the OS file cache (RAM) instead of the actual flash chip. UBench uses FILE_FLAG_NO_BUFFERING to bypass cache entirely. The UBench number is the truth. ๅ› ไธบไผ ็ปŸ่ท‘ๅˆ†่ฝฏไปถ่ฏปๅˆฐไบ† OS ็ผ“ๅญ˜(ๅ†…ๅญ˜้€Ÿๅบฆ),UBench ๅผบๅˆถ็ป•่ฟ‡็ผ“ๅญ˜ๅชๆต‹็œŸๅฎž้—ชๅญ˜ใ€‚

Can UBench numbers be compared to AS SSD Benchmark? / UBench ็š„ๆ•ฐๅญ—่ƒฝ่ทŸ AS SSD ๆˆชๅ›พๅฏนๆฏ”ๅ—?

Yes โ€” run ubench bench E:\ --asssd for the 6-test AS SSD compatibility profile. Direct comparison with merchant screenshots. ็”จ --asssd ๆจกๅผๅฏไปฅ็›ดๆŽฅๅฏนๆฏ” AS SSD ๆˆชๅ›พใ€‚

What's a good UBench Score for a USB drive? / U็›˜ UBench ๅพ—ๅˆ†ๅคšๅฐ‘ๆ‰็ฎ—ๅฅฝ?

  • 85+ : Premium tier (SanDisk Extreme Pro, Samsung Bar Plus level)
  • 70-84 : Good daily driver
  • 50-69 : Document storage only
  • 25-49 : Painful for many small files (e.g. running U-Claw)
  • 0-24 : Likely fake or defective

Is UBench faster than CrystalDiskMark? / UBench ๆฏ” CrystalDiskMark ๅฟซๅ—?

UBench --quick mode: ~1 minute. AS SSD compat: ~3 minutes. Full: ~10 minutes. CrystalDiskMark default 5ร—1GB: ~3-5 minutes. Similar.

What workloads does UBench measure? / UBench ๆต‹ไป€ไนˆๅœบๆ™ฏ?

  • Sequential 1MB: large file transfer (movies, ISOs)
  • Random 4K Q1T1: small files (U-Claw boot, photo browsing, Git operations)
  • Random 4K-64Thrd: heavy parallel load (virtual machines, video editing)
  • Sustained 60s write: SLC cache exhaustion (catches drives that look fast for 5 sec then collapse)
  • U-Claw small files: real workload of opening N small files in sequence

Does UBench support portable SSDs / M.2 NVMe? / ๆ”ฏๆŒ็งปๅŠจๅ›บๆ€/NVMe ๅ—?

Yes. UBench classifies the device automatically (USB flash / portable SSD / NVMe / SATA SSD / HDD) and uses the same scoring formula across all of them โ€” so a USB stick scoring 86 means absolute performance similar to an NVMe scoring 86. The classification is shown in the report only as a label.

How does UBench compare to CrystalDiskMark / AS SSD / ATTO? / ่ทŸ CDM / AS SSD / ATTO ๆฏ”?

See the comparison table above. Key differences: only UBench bypasses OS cache by default, detects fake capacity, tests SLC cache exhaustion, and produces signed reports.

Does UBench work on macOS? / ๆ”ฏๆŒ Mac ๅ—?

Yes โ€” uses F_NOCACHE fcntl on macOS for direct I/O. Build with cargo build --release.

Where can I see scores for popular USB drives? / ๅœจๅ“ช็œ‹ๆต่กŒ U ็›˜็š„ๅพ—ๅˆ†?

udiskbench.org scoreboard is in development. Until then, submit your JSON report via GitHub Issues using the drive-result template.


Related Projects / ็›ธๅ…ณ้กน็›ฎ

  • Microsoft DiskSpd โ€” the gold-standard low-level disk benchmark for Windows
  • CrystalDiskMark โ€” popular GUI front-end for DiskSpd
  • fio โ€” Linux/Unix flexible I/O tester
  • AS SSD Benchmark โ€” SSD-focused benchmark popular in Chinese market

Search Terms

USB benchmark ยท USB speed test ยท USB IOPS test ยท 4K random read test ยท fake USB detection ยท portable SSD benchmark ยท flash drive quality test ยท disk benchmark CLI ยท CrystalDiskMark alternative ยท AS SSD alternative ยท Rust disk benchmark ยท direct I/O benchmark ยท Windows storage benchmark ยท macOS storage benchmark ยท U็›˜่ท‘ๅˆ† ยท U็›˜้€Ÿๅบฆๆต‹่ฏ• ยท U็›˜่ดจ้‡ๆฃ€ๆต‹ ยท U็›˜็œŸๅ‡ ยท ๆ‰ฉๅฎน็›˜ๆฃ€ๆต‹ ยท ๅ‡U็›˜่ฏ†ๅˆซ ยท ็งปๅŠจๅ›บๆ€ๆต‹้€Ÿ ยท 4K้šๆœบ่ฏปๅ– ยท ่กŒไธšๆ ‡ๅ‡†่ท‘ๅˆ† ยท ๅผ€ๆบ่ท‘ๅˆ†ๅทฅๅ…ท

About

๐Ÿ”ฅ UBench โ€” ่กŒไธšๆ ‡ๅ‡† USB ่ท‘ๅˆ†ๅทฅๅ…ท๏ผš็ป•่ฟ‡ OS ็ผ“ๅญ˜็š„ Direct I/O ็œŸๅฎž้€Ÿๅบฆๆต‹้‡๏ผŒ่ฏ†ๅˆซๅ‡็›˜ๆ‰ฉๅฎน็›˜๏ผŒๅ…ผๅฎน CrystalDiskMark ไธŽ AS SSD ่พ“ๅ‡บใ€‚Rust CLI, Windows ๅฏ็”จใ€‚

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages