Skip to content

Match or exceed v1 performance#580

Open
jhollinger wants to merge 40 commits into
release-2.0from
jh/release-2.0-faster
Open

Match or exceed v1 performance#580
jhollinger wants to merge 40 commits into
release-2.0from
jh/release-2.0-faster

Conversation

@jhollinger
Copy link
Copy Markdown
Contributor

@jhollinger jhollinger commented Apr 16, 2026

After V1's recent perf improvements, V2's perf was no longer looking so good. These changes make V2 competitive again:

  • Stopped using the extension API for conditionals and default values. While cool, there was an optimization ceiling.
  • Fewer method calls and allocations during serialization (particularly when extensions aren't used).
  • Removed & simplified some extraneous features not present in V1. Allowed removal of lots of tests.

Perf varies with the number of fields, objects, and collections. It can also vary between the top-level serialization being a collection or object (collections are faster b/c some overhead is shared across loops). Use of extensions also caries some overhead (none were used in the measurements below).

# Collection results (20 fields, 5 objects, 2 collections)
1,000 widgets 100x: V2 change: -59.72%
500 widgets 100x: V2 change: -60.23%
250 widgets 100x: V2 change: -60.50%
100 widgets 100x: V2 change: -61.48%
25 widgets 100x: V2 change: -62.42%
5 widgets 100x:  V2 change: -60.14%
1 widgets 100x:  V2 change: -54.12%

# Object results (20 fields, 5 objects, 2 collections)
1,000 widgets 100x: V2 change: -32.68%
500 widgets 100x: V2 change: -33.49%
250 widgets 100x: V2 change: -32.39%
100 widgets 100x: V2 change: -35.35%
25 widgets 100x: V2 change: -36.85%
5 widgets 100x:  V2 change: -54.16%
1 widgets 100x:  V2 change: -52.25%

One thing we lost here is the ability to have extensions that are initialized per-render. I think it's possible to add again, but it will be more complicated, so IMHO we should wait until someone needs it.

Some other changes include:

  • Allow the fields DSL method to receive options and a block
  • Rename the field from option to source (reads better)
  • Allow around_blueprint_init to modify blueprint options and field details (previously it could only change field order or filter out fields)
  • Documentation branch: jh/release-2.0-docs

@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch 4 times, most recently from cf26f1a to 43f7db0 Compare April 16, 2026 19:21
@jhollinger jhollinger closed this Apr 18, 2026
@jhollinger jhollinger reopened this Apr 18, 2026
@jhollinger jhollinger changed the title Match v1 performance Match or exceed v1 performance Apr 18, 2026
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch 18 times, most recently from 98b34e4 to 5841499 Compare April 22, 2026 20:18
@jhollinger jhollinger marked this pull request as ready for review April 22, 2026 20:27
@jhollinger jhollinger requested review from a team and ritikesh as code owners April 22, 2026 20:27
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch from e83ea61 to b3d8412 Compare April 24, 2026 20:48
jhollinger added 11 commits May 21, 2026 11:26
…tion for collections)

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
…r inclusion is changed

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
…value as 2nd arg (so that ctx is always first arg)

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch 2 times, most recently from b5543f8 to a5cf165 Compare May 22, 2026 20:22
…result hook to run, so that it's easier for other extensions to decorate the result before it's JSONified

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
…eprint's views from V2

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
…d Procs

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch from a5cf165 to c065be7 Compare May 26, 2026 19:20
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch from 00a3abd to c15f238 Compare May 27, 2026 15:54
- No longer need `use!` since `use` is now positional.
- The DSL now builds a series of nodes which are evaled later.
- Replace `view`'s `empty` arg with the `exclude_all` DSL method.
- Options and extensions are now blocks (so they can interact properly with other DSL nodes)

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch 5 times, most recently from 1175e4e to 86cf98c Compare June 1, 2026 02:39
…DSL methods

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
…artials can be inherited

Signed-off-by: Jordan Hollinger <jordan.hollinger@procore.com>
@jhollinger jhollinger force-pushed the jh/release-2.0-faster branch from b9d79a6 to 2dc9670 Compare June 2, 2026 14:53
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