Skip to content

Conversation

@jawad-khan
Copy link
Collaborator

@jawad-khan jawad-khan commented Dec 23, 2025

Summary

Implements GitHub issue wagtail#570 by adding a load_benchmark_data management command to generate large-scale benchmark content for Wagtail performance testing.

The command allows configurable creation of pages, StreamField content, InlinePanel items, revisions, images, snippets, and translations.

Usage

python manage.py load_benchmark_data [OPTIONS]

Key Options (defaults)

--blog-pages-count (100000)

--streamfield-blocks-count (100)

--streamfield-depth (10)

--inline-panel-items-count (100)

--paragraphs-count (100)

--revisions-per-page-count (100000)

--page-tree-depth (10)

--images-count (100)

--snippets-count (100000)

--translations-count (100)

What This Adds

Large numbers of BlogPage instances with deep page trees

StreamField content with up to 100 blocks and 10 levels of nesting

Rich text content with configurable paragraph counts

InlinePanel data (100 items per sample page)

Page revisions for revision-scale testing

Generated placeholder images

Bulk-created snippets

Locale creation and translated page copies

Issue wagtail#570 Coverage

100 StreamField blocks

10 levels of StreamField nesting

100 InlinePanel items

100 rich text paragraphs

100k+ pages (configurable)

Deep page tree

Large revision counts

Images and snippet scale

Up to 100 translations

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors a Django management command for loading benchmark data, adding configurability through command-line arguments and introducing new functionality for creating images and snippets. However, the refactoring introduces several critical bugs and removes important functionality.

Key Changes:

  • Added command-line arguments to configure benchmark data quantities (pages, blocks, images, snippets, etc.)
  • Implemented benchmark image creation using PIL instead of fixture files
  • Added bulk snippet creation for BreadType, Country, and BreadIngredient models
  • Restructured code into smaller methods with progress reporting
  • Removed transaction wrapping and duplicate-checking logic from page creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ingredients = [BreadIngredient(name=f"Ingredient {i * j + 1}") for j in range(batch_size)]
BreadIngredient.objects.bulk_create(ingredients, ignore_conflicts=True)

created_count += batch_size*3
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expression 'batch_size*3' should have spaces around the multiplication operator for better readability and consistency with Python style guidelines (PEP 8).

Suggested change
created_count += batch_size*3
created_count += batch_size * 3

Copilot uses AI. Check for mistakes.
@jawad-khan jawad-khan changed the title fix: refactore code Add load_benchmark_data management command for performance testing Dec 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 14 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 15 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@awais786 awais786 merged commit 1b37b8e into awais786:benchmark-data-pr1 Dec 29, 2025
6 checks passed
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.

2 participants