Skip to content

Commit 98ac9f9

Browse files
committed
Docs: Performance page on public benchmark medians, new navigation and theme
1 parent 0ffe379 commit 98ac9f9

11 files changed

Lines changed: 1001 additions & 1195 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
88
## [Unreleased]
99

1010
### Changed
11+
- **Documentation:** every figure on the Performance page now comes from the
12+
public benchmark project (booted Laravel app, medians of 7 runs), replacing
13+
the earlier standalone-script numbers. The "50× less memory with
14+
`lazyCollection()`" claim is gone: with both libraries streaming, peak
15+
memory is equal and the difference is throughput (~1.85×).
16+
- **Documentation:** new navigation by section, home page and theme.
1117
- **Documentation:** the XML figures in the README and on the
1218
[Performance](https://std-out.github.io/simple-data-objects/guide/performance)
1319
page now come from the public benchmark (`make bench-xml`), and memory is

‎docs/.vitepress/config.mjs‎

Lines changed: 191 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,220 @@
11
import { defineConfig } from 'vitepress'
22

3-
// "Blueprint" code palette from the design handoff (docs-page-1d)
4-
const blueprintCodeTheme = {
5-
name: 'blueprint-dark',
6-
type: 'dark',
7-
colors: {
8-
'editor.background': '#0C1220',
9-
'editor.foreground': '#C9D4EE',
10-
},
11-
tokenColors: [
12-
{ scope: ['comment', 'punctuation.definition.comment'], settings: { foreground: '#566184' } },
13-
{ scope: ['keyword', 'storage.type', 'storage.modifier', 'keyword.operator'], settings: { foreground: '#FF7A1A' } },
14-
{ scope: ['string', 'punctuation.definition.string', 'entity.name.function', 'support.function'], settings: { foreground: '#7EA6FF' } },
15-
{ scope: ['constant.numeric', 'constant.language', 'support.constant'], settings: { foreground: '#FFB36B' } },
16-
{ scope: ['variable', 'variable.other', 'entity.name.type', 'entity.name.class', 'support.class'], settings: { foreground: '#C9D4EE' } },
17-
],
18-
}
3+
const guide = [
4+
{
5+
text: 'Get started',
6+
items: [
7+
{ text: 'Introduction', link: '/guide/introduction' },
8+
{ text: 'Installation', link: '/guide/installation' },
9+
{ text: 'Quick start', link: '/guide/quick-start' },
10+
],
11+
},
12+
{
13+
text: 'Creating objects',
14+
items: [
15+
{ text: 'Hydration', link: '/features/hydration' },
16+
{ text: 'Validation', link: '/features/validation' },
17+
{ text: 'Collecting errors', link: '/features/error-accumulation' },
18+
{ text: 'Optional values', link: '/features/optional' },
19+
{ text: 'Input pipes', link: '/features/pipes' },
20+
],
21+
},
22+
{
23+
text: 'Output',
24+
items: [
25+
{ text: 'Serialization', link: '/features/serialization' },
26+
{ text: 'JSON Schema & TypeScript', link: '/features/schema-generation' },
27+
],
28+
},
29+
{
30+
text: 'Working with objects',
31+
items: [
32+
{ text: 'Immutable copies', link: '/features/with' },
33+
{ text: 'Comparing objects', link: '/features/comparison' },
34+
{ text: 'Collections', link: '/features/collections' },
35+
],
36+
},
37+
{
38+
text: 'Large data & production',
39+
items: [
40+
{ text: 'Streaming XML', link: '/features/xml' },
41+
{ text: 'Metadata cache', link: '/features/cache' },
42+
{ text: 'Performance', link: '/guide/performance' },
43+
],
44+
},
45+
{
46+
text: 'Coming from another library',
47+
items: [
48+
{ text: 'Migrating from laravel-data', link: '/guide/migrating-from-laravel-data' },
49+
],
50+
},
51+
]
52+
53+
const attributes = [
54+
{
55+
text: 'Overview',
56+
items: [{ text: 'All attributes', link: '/attributes/' }],
57+
},
58+
{
59+
text: 'Input & mapping',
60+
items: [
61+
{ text: '#[MapPropertyName]', link: '/attributes/map-property-name' },
62+
{ text: '#[MapInputName] / #[MapOutputName]', link: '/attributes/map-input-output-name' },
63+
{ text: '#[TransformKeys]', link: '/attributes/transform-keys' },
64+
{ text: '#[Flatten]', link: '/attributes/flatten' },
65+
{ text: '#[Pipe]', link: '/attributes/pipe' },
66+
{ text: '#[RejectUnknownKeys]', link: '/attributes/reject-unknown-keys' },
67+
],
68+
},
69+
{
70+
text: 'Types & validation',
71+
items: [
72+
{ text: '#[Cast]', link: '/attributes/cast' },
73+
{ text: '#[DataCollection]', link: '/attributes/data-collection' },
74+
{ text: '#[Discriminator]', link: '/attributes/discriminator' },
75+
{ text: '#[Rules]', link: '/attributes/rules' },
76+
{ text: '#[InferRules]', link: '/attributes/infer-rules' },
77+
],
78+
},
79+
{
80+
text: 'Output',
81+
items: [
82+
{ text: '#[Hidden]', link: '/attributes/hidden' },
83+
{ text: '#[IgnoreIfNull]', link: '/attributes/ignore-if-null' },
84+
{ text: '#[Computed]', link: '/attributes/computed' },
85+
{ text: '#[WrapIn]', link: '/attributes/wrap-in' },
86+
],
87+
},
88+
{
89+
text: 'XML & Laravel',
90+
items: [
91+
{ text: '#[XmlAttribute] / #[XmlElement] / #[XmlText]', link: '/attributes/xml' },
92+
{ text: '#[WhenLoaded]', link: '/attributes/when-loaded' },
93+
],
94+
},
95+
]
96+
97+
const casts = [
98+
{
99+
text: 'Overview',
100+
items: [
101+
{ text: 'All casts', link: '/casts/' },
102+
{ text: 'Writing your own', link: '/casts/custom' },
103+
],
104+
},
105+
{
106+
text: 'Dates & enums',
107+
items: [
108+
{ text: 'DateTimeCast', link: '/casts/date-time' },
109+
{ text: 'EnumCast', link: '/casts/enum' },
110+
],
111+
},
112+
{
113+
text: 'Scalars',
114+
items: [
115+
{ text: 'BooleanCast', link: '/casts/boolean' },
116+
{ text: 'IntegerCast & FloatCast', link: '/casts/numeric' },
117+
{ text: 'TrimCast', link: '/casts/trim' },
118+
],
119+
},
120+
{
121+
text: 'Structured values',
122+
items: [
123+
{ text: 'JsonCast', link: '/casts/json' },
124+
{ text: 'CommaSeparatedCast', link: '/casts/comma-separated' },
125+
{ text: 'MoneyCast', link: '/casts/money' },
126+
{ text: 'UuidCast', link: '/casts/uuid' },
127+
],
128+
},
129+
{
130+
text: 'Security',
131+
items: [{ text: 'EncryptedCast', link: '/casts/encrypted' }],
132+
},
133+
]
134+
135+
const frameworks = [
136+
{
137+
text: 'Laravel',
138+
items: [
139+
{ text: 'Setup in five minutes', link: '/integrations/laravel' },
140+
{ text: 'Requests, models & responses', link: '/laravel/' },
141+
{ text: 'Service provider & commands', link: '/laravel/service-provider' },
142+
{ text: 'Eloquent casting', link: '/laravel/eloquent-casting' },
143+
{ text: 'Livewire', link: '/laravel/livewire' },
144+
{ text: 'Pagination & response envelope', link: '/laravel/pagination' },
145+
],
146+
},
147+
{
148+
text: 'Other environments',
149+
items: [
150+
{ text: 'Plain PHP', link: '/integrations/plain-php' },
151+
{ text: 'Symfony', link: '/integrations/symfony' },
152+
{ text: 'Slim & PSR-7', link: '/integrations/psr-7' },
153+
],
154+
},
155+
]
19156

20157
export default defineConfig({
21158
title: 'Simple Data Objects',
22159
description: 'Lightweight, attribute-driven Data Transfer Objects for PHP 8.4+',
23160
base: '/simple-data-objects/',
24161

25162
head: [
26-
['link', { rel: 'icon', href: '/simple-data-objects/favicon.ico' }],
27-
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
28-
['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }],
29-
['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap' }],
163+
['link', { rel: 'icon', type: 'image/png', href: '/simple-data-objects/favicon.png' }],
30164
],
31165

32166
markdown: {
33-
theme: blueprintCodeTheme,
167+
theme: { light: 'github-light', dark: 'github-dark' },
34168
},
35169

36170
themeConfig: {
171+
logo: { light: '/logo.png', dark: '/logo-dark.png', alt: 'std-out' },
172+
37173
nav: [
38-
{ text: 'Guide', link: '/guide/installation' },
39-
{ text: 'Features', link: '/features/hydration' },
40-
{ text: 'Laravel', link: '/laravel/' },
41-
{ text: 'Casts', link: '/casts/' },
174+
{ text: 'Guide', link: '/guide/introduction', activeMatch: '^/(guide|features)/' },
42175
{
43-
text: 'v2.0 (current)',
176+
text: 'Reference',
177+
activeMatch: '^/(attributes|casts)/',
44178
items: [
45-
{ text: 'v2.0 (current)', link: '/' },
46-
{ text: 'v1.x (stable)', link: 'https://std-out.github.io/simple-data-objects/v1/' },
179+
{ text: 'Attributes', link: '/attributes/' },
180+
{ text: 'Built-in casts', link: '/casts/' },
47181
],
48182
},
49183
{
50-
text: 'GitHub',
51-
link: 'https://github.com/std-out/simple-data-objects',
184+
text: 'Frameworks',
185+
activeMatch: '^/(laravel|integrations)/',
186+
items: [
187+
{ text: 'Laravel', link: '/integrations/laravel' },
188+
{ text: 'Plain PHP', link: '/integrations/plain-php' },
189+
{ text: 'Symfony', link: '/integrations/symfony' },
190+
{ text: 'Slim & PSR-7', link: '/integrations/psr-7' },
191+
],
192+
},
193+
{ text: 'Performance', link: '/guide/performance' },
194+
{
195+
text: 'v2',
196+
items: [
197+
{ text: 'v2 (current)', link: '/' },
198+
{ text: 'v1 (stable)', link: 'https://std-out.github.io/simple-data-objects/v1/' },
199+
{ text: 'Changelog', link: 'https://github.com/std-out/simple-data-objects/blob/main/CHANGELOG.md' },
200+
],
52201
},
53202
],
54203

55204
sidebar: {
56-
'/laravel/': [
57-
{
58-
text: 'Laravel',
59-
items: [
60-
{ text: 'Overview', link: '/laravel/' },
61-
{ text: 'Service Provider & Commands', link: '/laravel/service-provider' },
62-
{ text: 'Eloquent Attribute Casting', link: '/laravel/eloquent-casting' },
63-
{ text: 'Livewire Integration', link: '/laravel/livewire' },
64-
{ text: 'Pagination & Response Envelope', link: '/laravel/pagination' },
65-
{ text: '#[WhenLoaded]', link: '/attributes/when-loaded' },
66-
],
67-
},
68-
],
205+
'/guide/': guide,
206+
'/features/': guide,
207+
'/attributes/': attributes,
208+
'/casts/': casts,
209+
'/laravel/': frameworks,
210+
'/integrations/': frameworks,
211+
},
212+
213+
outline: { level: [2, 3], label: 'On this page' },
69214

70-
'/': [
71-
{
72-
text: 'Getting Started',
73-
items: [
74-
{ text: 'Introduction', link: '/guide/introduction' },
75-
{ text: 'Installation', link: '/guide/installation' },
76-
{ text: 'Quick Start', link: '/guide/quick-start' },
77-
{ text: 'Performance', link: '/guide/performance' },
78-
{ text: 'Migrating from spatie/laravel-data', link: '/guide/migrating-from-laravel-data' },
79-
],
80-
},
81-
{
82-
text: 'Features',
83-
items: [
84-
{ text: 'Hydration', link: '/features/hydration' },
85-
{ text: 'Serialization', link: '/features/serialization' },
86-
{ text: 'Validation', link: '/features/validation' },
87-
{ text: 'fromResult() — Error Accumulation', link: '/features/error-accumulation' },
88-
{ text: 'Optional — Absent vs Null', link: '/features/optional' },
89-
{ text: 'Schema Generation — JSON Schema & TypeScript', link: '/features/schema-generation' },
90-
{ text: 'DataPipe — Preprocessing', link: '/features/pipes' },
91-
{ text: 'Immutable Copies — with()', link: '/features/with' },
92-
{ text: 'Comparison — equals() & diff()', link: '/features/comparison' },
93-
{ text: 'Collections', link: '/features/collections' },
94-
{ text: 'Streaming XML', link: '/features/xml' },
95-
{ text: 'Metadata Cache', link: '/features/cache' },
96-
],
97-
},
98-
{
99-
text: 'Integrations',
100-
items: [
101-
{ text: 'Plain PHP', link: '/integrations/plain-php' },
102-
{ text: 'Laravel', link: '/integrations/laravel' },
103-
{ text: 'Symfony', link: '/integrations/symfony' },
104-
{ text: 'Slim & PSR-7', link: '/integrations/psr-7' },
105-
],
106-
},
107-
{
108-
text: 'Attributes',
109-
items: [
110-
{ text: 'Overview', link: '/attributes/' },
111-
{ text: '#[Cast]', link: '/attributes/cast' },
112-
{ text: '#[Rules]', link: '/attributes/rules' },
113-
{ text: '#[InferRules]', link: '/attributes/infer-rules' },
114-
{ text: '#[Pipe]', link: '/attributes/pipe' },
115-
{ text: '#[Flatten]', link: '/attributes/flatten' },
116-
{ text: '#[Hidden]', link: '/attributes/hidden' },
117-
{ text: '#[IgnoreIfNull]', link: '/attributes/ignore-if-null' },
118-
{ text: '#[Computed]', link: '/attributes/computed' },
119-
{ text: '#[MapPropertyName]', link: '/attributes/map-property-name' },
120-
{ text: '#[MapInputName] / #[MapOutputName]', link: '/attributes/map-input-output-name' },
121-
{ text: '#[TransformKeys]', link: '/attributes/transform-keys' },
122-
{ text: '#[Discriminator]', link: '/attributes/discriminator' },
123-
{ text: '#[DataCollection]', link: '/attributes/data-collection' },
124-
{ text: '#[WhenLoaded]', link: '/attributes/when-loaded' },
125-
{ text: '#[RejectUnknownKeys]', link: '/attributes/reject-unknown-keys' },
126-
{ text: '#[WrapIn]', link: '/attributes/wrap-in' },
127-
{ text: '#[XmlAttribute] / #[XmlElement] / #[XmlText]', link: '/attributes/xml' },
128-
],
129-
},
130-
{
131-
text: 'Built-in Casts',
132-
items: [
133-
{ text: 'Overview', link: '/casts/' },
134-
{ text: 'DateTimeCast', link: '/casts/date-time' },
135-
{ text: 'EnumCast', link: '/casts/enum' },
136-
{ text: 'BooleanCast', link: '/casts/boolean' },
137-
{ text: 'IntegerCast & FloatCast', link: '/casts/numeric' },
138-
{ text: 'TrimCast', link: '/casts/trim' },
139-
{ text: 'JsonCast', link: '/casts/json' },
140-
{ text: 'EncryptedCast', link: '/casts/encrypted' },
141-
{ text: 'UuidCast', link: '/casts/uuid' },
142-
{ text: 'CommaSeparatedCast', link: '/casts/comma-separated' },
143-
{ text: 'MoneyCast', link: '/casts/money' },
144-
{ text: 'Custom Casts', link: '/casts/custom' },
145-
],
146-
},
147-
],
215+
editLink: {
216+
pattern: 'https://github.com/std-out/simple-data-objects/edit/main/docs/:path',
217+
text: 'Suggest a change to this page',
148218
},
149219

150220
socialLinks: [

0 commit comments

Comments
 (0)