Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some CPU improvements #608

Merged
merged 8 commits into from
Mar 19, 2022
Merged

Some CPU improvements #608

merged 8 commits into from
Mar 19, 2022

Conversation

MihaZupan
Copy link
Collaborator

  • Caching the FencedCodeBlock.InfoString & language-prefixed strings
  • Using ValueStringBuilder over StringBuilderCache.Local()
  • Avoiding the cost of type checks & casting for ContainerBlock, LeafBlock, ParagraphBlock and ContainerInline by setting flags on the base type instead (this is a ~5% CPU win by removing S.R.CompilerServices.CastHelpers.IsInstanceOfClass).
  • Improved StringLineGroup.NextChar - very hot method for LinkHelper

Parsing this document with PreciseSourceLocation:

Before

Method SourceText Mean Error StdDev Gen 0 Allocated
Parse TracingArticle 42.77 us 0.232 us 0.332 us 4.4556 18 KB

After

Method SourceText Mean Error StdDev Gen 0 Allocated
Parse TracingArticle 37.39 us 0.215 us 0.309 us 4.3945 18 KB

@coveralls
Copy link

coveralls commented Mar 14, 2022

Pull Request Test Coverage Report for Build 1980002829

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 523 of 546 (95.79%) changed or added relevant lines in 27 files are covered.
  • 13 unchanged lines in 3 files lost coverage.
  • Overall coverage remained the same at 93.053%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Markdig/Helpers/StringLineGroup.cs 70 71 98.59%
src/Markdig/Helpers/LinkHelper.cs 57 59 96.61%
src/Markdig/Helpers/StringSlice.cs 7 9 77.78%
src/Markdig/Parsers/BlockProcessor.cs 33 35 94.29%
src/Markdig/Helpers/TransformedStringCache.cs 75 79 94.94%
src/Markdig/Helpers/ValueStringBuilder.cs 96 108 88.89%
Files with Coverage Reduction New Missed Lines %
src/Markdig/Helpers/LinkHelper.cs 2 91.55%
src/Markdig/Helpers/StringLineGroup.cs 3 94.37%
src/Markdig/Helpers/StringBuilderCache.cs 8 0.0%
Totals Coverage Status
Change from base Build 1979509409: 0.0%
Covered Lines: 25100
Relevant Lines: 26343

💛 - Coveralls

@xoofx xoofx merged commit 358a5f0 into xoofx:master Mar 19, 2022
@xoofx
Copy link
Owner

xoofx commented Mar 19, 2022

Thanks a lot, amazing numbers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants