Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,16 @@
import com.demcha.compose.document.style.DocumentInsets;
import com.demcha.compose.document.style.DocumentTextDecoration;
import com.demcha.compose.document.style.DocumentTextStyle;
import com.demcha.compose.document.templates.blocks.BulletListBlock;
import com.demcha.compose.document.templates.blocks.IndentedBlock;
import com.demcha.compose.document.templates.blocks.KeyValueBlock;
import com.demcha.compose.document.templates.blocks.MultiParagraphBlock;
import com.demcha.compose.document.templates.blocks.ParagraphBlock;
import com.demcha.compose.document.templates.cv.spec.CvHeader;
import com.demcha.compose.document.templates.cv.spec.CvModule;
import com.demcha.compose.document.templates.cv.spec.CvSpec;
import com.demcha.compose.document.templates.cv.v2.data.CvDocument;
import com.demcha.compose.document.templates.data.invoice.InvoiceDocumentSpec;
import com.demcha.compose.document.templates.data.proposal.ProposalDocumentSpec;
import com.demcha.compose.engine.components.style.Margin;
import com.demcha.mock.CvDataFixtures;
import com.demcha.mock.InvoiceDataFixtures;
import com.demcha.mock.ProposalDataFixtures;
import org.apache.pdfbox.pdmodel.common.PDRectangle;

import java.awt.Color;
import java.util.List;

public final class CanonicalBenchmarkSupport {
static final DocumentTextStyle TITLE_STYLE = DocumentTextStyle.builder()
Expand All @@ -40,59 +33,12 @@ private CanonicalBenchmarkSupport() {
}

/**
* Canonical CV spec used by Templates v2 benchmarks. Mirrors the
* shape of {@code PresetVisualParityTest.canonicalCvSpec()} so the
* benchmarks render the same realistic CV the visual parity gate
* locks down. The legacy V1 {@code CvDocumentSpec} helper was
* removed alongside {@code CvTemplateV1} when Templates v2 landed
* in v1.6.
* Canonical v2 {@link CvDocument} used by the CV benchmarks — a realistic
* multi-section CV render workload. Sourced from {@link CvDataFixtures} so
* the fixture is shared with the rest of the benchmark suite.
*/
public static CvSpec canonicalCv() {
return CvSpec.builder()
.header(CvHeader.builder()
.name("Jordan Rivera")
.jobTitle("Backend Java Developer")
.address("London, UK")
.phone("+44 20 5555 1000")
.email("jordan@demo.dev")
.link("LinkedIn", "https://linkedin.com/in/jordan-rivera-demo")
.link("GitHub", "https://github.com/jordan-rivera-demo")
.build())
.module(CvModule.of("Professional Summary",
new ParagraphBlock(
"Platform engineer building resilient PDF and "
+ "document-generation workflows for reliable "
+ "business output.")))
.module(CvModule.of("Technical Skills",
new BulletListBlock(List.of(
"Java 21, PDFBox, Maven, REST APIs",
"Template design systems, pagination, semantic layout composition",
"Testing strategy, CI pipelines, developer enablement"))))
.module(CvModule.of("Education & Certifications",
new IndentedBlock(List.of(
new IndentedBlock.Item("MSc Computer Science",
"University of Manchester | 2021"),
new IndentedBlock.Item("Oracle Java Certification",
"Professional track | 2023")))))
.module(CvModule.of("Projects",
new IndentedBlock(List.of(
new IndentedBlock.Item("GraphCompose",
"Declarative PDF layout engine for reusable document generation"),
new IndentedBlock.Item("Template Studio",
"Internal tool for evaluating CV, proposal, and invoice output")))))
.module(CvModule.of("Professional Experience",
new MultiParagraphBlock(List.of(
"**Senior Platform Engineer**, Northwind Systems | "
+ "*2024-Present* — Led reusable document flows.",
"**Software Engineer**, BrightLeaf Labs | *2021-2024* "
+ "— Built backend services and rendering pipelines."))))
.module(CvModule.of("Additional Information",
new KeyValueBlock(List.of(
new KeyValueBlock.Entry("Location",
"Based in London and available for hybrid or remote collaboration"),
new KeyValueBlock.Entry("Interests",
"Platform architecture, DX, and document-quality automation")))))
.build();
public static CvDocument canonicalCv() {
return CvDataFixtures.canonicalCv();
}

public static InvoiceDocumentSpec canonicalInvoice() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
import com.demcha.compose.document.style.DocumentTextStyle;
import com.demcha.compose.document.svg.SvgIcon;
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.cv.presets.ModernProfessional;
import com.demcha.compose.document.templates.cv.spec.CvSpec;
import com.demcha.compose.document.templates.cv.v2.data.CvDocument;
import com.demcha.compose.document.templates.cv.v2.presets.ModernProfessional;
import com.demcha.compose.document.templates.data.invoice.InvoiceDocumentSpec;
import com.demcha.compose.document.templates.data.proposal.ProposalDocumentSpec;
import com.demcha.compose.document.templates.invoice.v2.presets.ModernInvoice;
import com.demcha.compose.document.templates.proposal.v2.presets.ModernProposal;
import com.demcha.compose.document.theme.BusinessTheme;
import com.demcha.compose.engine.components.style.Margin;
import org.apache.pdfbox.pdmodel.common.PDRectangle;

Expand Down Expand Up @@ -86,11 +85,11 @@ public final class CurrentSpeedBenchmark {
.build();

private final DocumentTemplate<InvoiceDocumentSpec> invoiceTemplate = ModernInvoice.create();
private final DocumentTemplate<CvSpec> cvTemplate = ModernProfessional.create(BusinessTheme.modern());
private final DocumentTemplate<CvDocument> cvTemplate = ModernProfessional.create();
private final DocumentTemplate<ProposalDocumentSpec> proposalTemplate = ModernProposal.create();
private final InvoiceDocumentSpec invoice = CanonicalBenchmarkSupport.canonicalInvoice();
private final ProposalDocumentSpec proposal = CanonicalBenchmarkSupport.canonicalProposal();
private final CvSpec cv = CanonicalBenchmarkSupport.canonicalCv();
private final CvDocument cv = CanonicalBenchmarkSupport.canonicalCv();
// Parsed/built once (like the template fixtures above) so the vector-rich
// scenario measures the render, not a per-iteration SVG re-parse.
private final SvgIcon vectorRichIcon = SvgIcon.parse(SvgBenchmarkFixtures.MULTI_LAYER_ICON_SVG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import com.demcha.compose.document.api.DocumentPageSize;
import com.demcha.compose.document.api.DocumentSession;
import com.demcha.compose.document.style.DocumentInsets;
import com.demcha.compose.document.templates.cv.presets.ModernProfessional;
import com.demcha.compose.document.templates.cv.spec.CvSpec;
import com.demcha.compose.document.templates.cv.v2.data.CvDocument;
import com.demcha.compose.document.templates.cv.v2.presets.ModernProfessional;
import com.demcha.compose.document.templates.data.invoice.InvoiceDocumentSpec;
import com.demcha.compose.document.templates.invoice.v2.presets.ModernInvoice;
import com.demcha.compose.document.theme.BusinessTheme;
import com.demcha.compose.document.templates.api.DocumentTemplate;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
Expand Down Expand Up @@ -57,16 +56,16 @@ public class ColdStartJmhBenchmark {

private InvoiceDocumentSpec invoice;
private DocumentTemplate<InvoiceDocumentSpec> invoiceTemplate;
private CvSpec cv;
private DocumentTemplate<CvSpec> cvTemplate;
private CvDocument cv;
private DocumentTemplate<CvDocument> cvTemplate;

/** Builds the specs and templates once per fork, outside the measured cold shot. */
@Setup
public void setUp() {
invoice = CanonicalBenchmarkSupport.canonicalInvoice();
invoiceTemplate = ModernInvoice.create();
cv = CanonicalBenchmarkSupport.canonicalCv();
cvTemplate = ModernProfessional.create(BusinessTheme.modern());
cvTemplate = ModernProfessional.create();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import com.demcha.compose.document.api.DocumentSession;
import com.demcha.compose.document.style.DocumentInsets;
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.cv.presets.ModernProfessional;
import com.demcha.compose.document.templates.cv.spec.CvSpec;
import com.demcha.compose.document.theme.BusinessTheme;
import com.demcha.compose.document.templates.cv.v2.data.CvDocument;
import com.demcha.compose.document.templates.cv.v2.presets.ModernProfessional;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand Down Expand Up @@ -44,16 +43,16 @@
@Fork(1)
public class TemplateCvJmhBenchmark {

private CvSpec cv;
private DocumentTemplate<CvSpec> template;
private CvDocument cv;
private DocumentTemplate<CvDocument> template;

/**
* Builds the canonical CV spec and the template once, outside measurement.
*/
@Setup
public void setUp() {
cv = CanonicalBenchmarkSupport.canonicalCv();
template = ModernProfessional.create(BusinessTheme.modern());
template = ModernProfessional.create();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import com.demcha.compose.document.templates.cv.v2.data.RowStyle;
import com.demcha.compose.document.templates.cv.v2.data.RowsSection;
import com.demcha.compose.document.templates.cv.v2.data.SkillsSection;
import com.demcha.compose.document.templates.data.common.EmailYaml;
import com.demcha.compose.document.templates.data.common.Header;
import com.demcha.compose.document.templates.data.invoice.InvoiceDocumentSpec;
import com.demcha.compose.document.templates.data.cv.CvDocumentSpec;
import com.demcha.compose.document.templates.data.proposal.ProposalDocumentSpec;
import com.demcha.compose.document.templates.data.schedule.ScheduleSlot;
import com.demcha.compose.document.templates.data.schedule.WeeklyScheduleDocumentSpec;
Expand All @@ -25,45 +22,6 @@ public final class ExampleDataFactory {
private ExampleDataFactory() {
}

public static CvDocumentSpec sampleCv() {
return CvDocumentSpec.builder()
.header(sampleHeader())
.summary("Platform engineer building resilient PDF and document-generation workflows for reliable business output.")
.technicalSkills(
"Java 21, PDFBox, Maven, REST APIs",
"Template design systems, pagination, semantic layout composition",
"Testing strategy, CI pipelines, developer enablement")
.education(
"**MSc Computer Science** - University of Manchester | 2021",
"**Oracle Java Certification** - Professional track | 2023")
.projects(
"**GraphCompose** - Declarative PDF layout engine for reusable document generation",
"**Template Studio** - Internal tool for evaluating CV, proposal, and invoice output")
.experience(
"**Senior Platform Engineer**, Northwind Systems | *2024-Present* - Led reusable document flows for reporting, billing, and hiring operations.",
"**Software Engineer**, BrightLeaf Labs | *2021-2024* - Built backend services and production document rendering pipelines.")
.additional(
"Based in London and available for hybrid or remote collaboration.",
"Interested in platform architecture, DX, and document-quality automation.")
.build();
}

public static Header sampleHeader() {
return Header.builder()
.name("Jordan Rivera")
.address("London, UK")
.phoneNumber("+44 20 5555 1000")
.email(EmailYaml.builder()
.to("jordan.rivera@example.com")
.subject("Job Application")
.body("Hello")
.displayText("jordan.rivera@example.com")
.build())
.linkedIn("https://linkedin.com/in/jordan-rivera-demo", "LinkedIn")
.gitHub("https://github.com/jrivera-demo", "GitHub")
.build();
}

public static InvoiceDocumentSpec sampleInvoice() {
return InvoiceDocumentSpec.builder()
.title("Invoice")
Expand Down
117 changes: 0 additions & 117 deletions src/main/java/com/demcha/compose/document/templates/api/SlotMap.java

This file was deleted.

Loading
Loading