Skip to content

Conversation

@simonthum
Copy link

This cuts about 20% of parsing cost and probably more in final object graph size, depending on input data.

In terms of the LoadLarge benchmark:

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
LoadLarge before 136.9 ms 3.11 ms 9.03 ms 7500.0000 3500.0000 1500.0000 39.65 MB
LoadLarge after 114.4 ms 3.70 ms 10.67 ms 6000.0000 2000.0000 1000.0000 39.65 MB

This is just a simple string.Intern call. It might make sense to employ or pass a pool, like a XmlNameTable does with XML, to save on scalar objects not just strings.

As for my motivation, yaml parsing dominates a startup time I care about. This seems like an easy fix.

This cuts about 20% of parsing cost and probably more in final
object graph size, depending on input data.

In terms of the LoadLarge benchmark:

| Method           | Mean     | Error   | StdDev   | Gen0      | Gen1      | Gen2      | Allocated |
|-----------------:|---------:|--------:|---------:|----------:|----------:|----------:|----------:|
| LoadLarge before | 136.9 ms | 3.11 ms | 9.03 ms  | 7500.0000 | 3500.0000 | 1500.0000 |  39.65 MB |
| LoadLarge after  | 114.4 ms | 3.70 ms | 10.67 ms | 6000.0000 | 2000.0000 | 1000.0000 |  39.65 MB |

This is just a simple string.Intern call. It might make sense to emplyor pass a pool, like
a XmlNameTable does with XML, to save on scalar objects not just strings.
@simonthum
Copy link
Author

The build failure seems unrelated to the changes.

@EdwardCooke
Copy link
Collaborator

It's because your branch name is master. If you use a branch not named master we can work on getting this merged in.

@simonthum simonthum closed this May 14, 2025
@simonthum
Copy link
Author

I opened another PR to change the branch.

@simonthum
Copy link
Author

See #1055

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