Skip to content

Perf #36439 -- Added performance benchmark for acheck_password hashing via asyncio#94

Open
roelzkie15 wants to merge 1 commit into
django:mainfrom
roelzkie15:perf-36439-auth-hashing-benchmark
Open

Perf #36439 -- Added performance benchmark for acheck_password hashing via asyncio#94
roelzkie15 wants to merge 1 commit into
django:mainfrom
roelzkie15:perf-36439-auth-hashing-benchmark

Conversation

@roelzkie15

@roelzkie15 roelzkie15 commented Jul 24, 2025

Copy link
Copy Markdown

This performance benchmark was added as part of the django/django/pull/19611 as requested by the reviewer.

Setup

Using the following asv.config.json file:

{
  "version": 1,
  "project": "Django",
  "project_url": "https://www.djangoproject.com/",
  "repo": "https://github.com/roelzkie15/django.git",
  "branches": ["main"],
  "build_command": [
    "python -m pip install build bcrypt argon2-cffi",
    "python -m build --wheel -o {build_cache_dir} {build_dir}"
  ],
  "environment_type": "conda", 
  "show_commit_url": "https://github.com/roelzkie15/django/commit/",
  "pythons": ["3.12", "3.13"]
}

You may also use virtualenv for the environment_type, just make sure you're in a virtual environment.

Collecting data

Getting the result of the main branch (HEAD).

asv run main^! -b hasher_benchmarks

Getting the result of the pull request's branch fix-36439-auth-hashing-performance.

asv run fix-36439-auth-hashing-performance^! -b hasher_benchmarks

Then compare the benchmark:

asv compare main fix-36439-auth-hashing-performance --machine <os>

Result output from my benchmark:

All benchmarks:

| Change   | Before [77d455ae] <main>   | After [ce3e0e7b] <fix-36439-auth-hashing-performance>   |   Ratio | Benchmark (Parameter)                                                                                    |
|----------|----------------------------|---------------------------------------------------------|---------|----------------------------------------------------------------------------------------------------------|
| -        | 421±1ms                    | 151±0.4ms                                               |    0.36 | hasher_benchmarks.hash_acheck_password.benchmark.Hasher.time_acheck_password('PBKDF2PasswordHasher')     |
| -        | 454±0.5ms                  | 163±0.2ms                                               |    0.36 | hasher_benchmarks.hash_acheck_password.benchmark.Hasher.time_acheck_password('PBKDF2SHA1PasswordHasher') |
| -        | 91.1±3ms                   | 74.2±0.3ms                                              |    0.81 | hasher_benchmarks.hash_acheck_password.benchmark.HasherArgon.time_acheck_password                        |
| -        | 697±0.4ms                  | 250±0.2ms                                               |    0.36 | hasher_benchmarks.hash_acheck_password.benchmark.HasherBcrypt.time_acheck_password                       |
| -        | 483±3ms                    | 179±1ms                                                 |    0.37 | hasher_benchmarks.hash_acheck_password.benchmark.HasherScypt.time_acheck_password                        |

@roelzkie15 roelzkie15 force-pushed the perf-36439-auth-hashing-benchmark branch from 47829a5 to 61e8967 Compare July 24, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant