Skip to content

Commit 31d8dcf

Browse files
committed
deploy: e4bf4e7
0 parents  commit 31d8dcf

31 files changed

+8367
-0
lines changed

.nojekyll

Whitespace-only changes.

api/index.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!DOCTYPE html>
2+
<!--[if IE]><![endif]-->
3+
<html>
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8+
<title>Api Documentation | ValueStringBuilder </title>
9+
<meta name="viewport" content="width=device-width">
10+
<meta name="title" content="Api Documentation | ValueStringBuilder ">
11+
<meta name="generator" content="docfx 2.59.4.0">
12+
<meta name="description" content="The ValueStringBuilder is a fast and low allocating StringBuilder meant for scenarios where every allocation and millisecond is important.">
13+
<link rel="shortcut icon" href="../images/logo.png">
14+
<link rel="stylesheet" href="../styles/docfx.vendor.css">
15+
<link rel="stylesheet" href="../styles/docfx.css">
16+
<link rel="stylesheet" href="../styles/main.css">
17+
<meta property="docfx:navrel" content="../toc.html">
18+
<meta property="docfx:tocrel" content="../toc.html">
19+
20+
<meta property="docfx:rel" content="../">
21+
22+
</head>
23+
<body data-spy="scroll" data-target="#affix" data-offset="120">
24+
<div id="wrapper">
25+
<header>
26+
27+
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
28+
<div class="container">
29+
<div class="navbar-header">
30+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
31+
<span class="sr-only">Toggle navigation</span>
32+
<span class="icon-bar"></span>
33+
<span class="icon-bar"></span>
34+
<span class="icon-bar"></span>
35+
</button>
36+
37+
<a class="navbar-brand" href="../index.html">
38+
<img id="logo" class="svg" src="../images/logo.png" alt="ValueStringBuilder">
39+
</a>
40+
</div>
41+
<div class="collapse navbar-collapse" id="navbar">
42+
<form class="navbar-form navbar-right" role="search" id="search">
43+
<div class="form-group">
44+
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
45+
</div>
46+
</form>
47+
</div>
48+
</div>
49+
</nav>
50+
</header>
51+
<div class="container body-content">
52+
53+
<div id="search-results">
54+
<div class="search-list">Search Results for <span></span></div>
55+
<div class="sr-items">
56+
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
57+
</div>
58+
<ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
59+
</div>
60+
</div>
61+
<div role="main" class="container body-content hide-when-search">
62+
<div class="article row grid">
63+
<div class="col-md-10">
64+
<article class="content wrap" id="_content" data-uid="">
65+
<h1 id="api-documentation">Api Documentation</h1>
66+
67+
<p>Here you will find an overview over all exposed objects and their documentation.</p>
68+
</article>
69+
</div>
70+
71+
<div class="hidden-sm col-md-2" role="complementary">
72+
<div class="sideaffix">
73+
<div class="contribution">
74+
<ul class="nav">
75+
<li>
76+
<a href="https://github.com/linkdotnet/StringBuilder/blob/stable/docs/site/api/index.md/#L1" class="contribution-link">Improve this Doc</a>
77+
</li>
78+
</ul>
79+
</div>
80+
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
81+
<h5>In This Article</h5>
82+
<div></div>
83+
</nav>
84+
</div>
85+
</div>
86+
</div>
87+
</div>
88+
</div>
89+
90+
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
91+
<script type="text/javascript" src="../styles/docfx.js"></script>
92+
<script type="text/javascript" src="../styles/main.js"></script>
93+
</body>
94+
</html>

articles/comparison.html

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<!DOCTYPE html>
2+
<!--[if IE]><![endif]-->
3+
<html>
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8+
<title>Comparison | ValueStringBuilder </title>
9+
<meta name="viewport" content="width=device-width">
10+
<meta name="title" content="Comparison | ValueStringBuilder ">
11+
<meta name="generator" content="docfx 2.59.4.0">
12+
<meta name="description" content="The ValueStringBuilder is a fast and low allocating StringBuilder meant for scenarios where every allocation and millisecond is important.">
13+
<link rel="shortcut icon" href="../images/logo.png">
14+
<link rel="stylesheet" href="../styles/docfx.vendor.css">
15+
<link rel="stylesheet" href="../styles/docfx.css">
16+
<link rel="stylesheet" href="../styles/main.css">
17+
<meta property="docfx:navrel" content="../toc.html">
18+
<meta property="docfx:tocrel" content="toc.html">
19+
20+
<meta property="docfx:rel" content="../">
21+
22+
</head>
23+
<body data-spy="scroll" data-target="#affix" data-offset="120">
24+
<div id="wrapper">
25+
<header>
26+
27+
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
28+
<div class="container">
29+
<div class="navbar-header">
30+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
31+
<span class="sr-only">Toggle navigation</span>
32+
<span class="icon-bar"></span>
33+
<span class="icon-bar"></span>
34+
<span class="icon-bar"></span>
35+
</button>
36+
37+
<a class="navbar-brand" href="../index.html">
38+
<img id="logo" class="svg" src="../images/logo.png" alt="ValueStringBuilder">
39+
</a>
40+
</div>
41+
<div class="collapse navbar-collapse" id="navbar">
42+
<form class="navbar-form navbar-right" role="search" id="search">
43+
<div class="form-group">
44+
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
45+
</div>
46+
</form>
47+
</div>
48+
</div>
49+
</nav>
50+
</header>
51+
<div class="container body-content">
52+
53+
<div id="search-results">
54+
<div class="search-list">Search Results for <span></span></div>
55+
<div class="sr-items">
56+
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
57+
</div>
58+
<ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
59+
</div>
60+
</div>
61+
<div role="main" class="container body-content hide-when-search">
62+
63+
<div class="sidenav hide-when-search">
64+
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
65+
<div class="sidetoggle collapse" id="sidetoggle">
66+
<div id="sidetoc"></div>
67+
</div>
68+
</div>
69+
<div class="article row grid-right">
70+
<div class="col-md-10">
71+
<article class="content wrap" id="_content" data-uid="comparison">
72+
<h1 id="comparison">Comparison</h1>
73+
74+
<p>The following document will show some key differences between the <code>ValueStringBuilder</code> and similar working string builder like the one from .NET itself.</p>
75+
<h2 id="systemtextstringbuilder">System.Text.StringBuilder</h2>
76+
<p>The <code>StringBuilder</code> shipped with the .NET Framework itself is a all-purpose string builder which allows a versatile use. <code>ValueStringBuilder</code> tries to mimic the API as much as possible so developers can adopt the <code>ValueStringBuilder</code> easily where it makes sense. In the following part <code>StringBuilder</code> refers to <code>System.Text.StringBuilder</code>.</p>
77+
<p><strong>Key differences</strong>:</p>
78+
<ul>
79+
<li><code>StringBuilder</code> is a class and does not have the restrictions coming with a <code>ref struct</code>. To know more head over to the <a class="xref" href="known_limitations.html">known limitations</a> section.</li>
80+
<li><code>StringBuilder</code> works not on <code>Span&lt;T&gt;</code> but more on <code>string</code>s or <code>char</code>s. Sometimes even with pointers</li>
81+
<li><code>StringBuilder</code> uses chunks to represent the string, which the larger the string gets, the better it can perform. <code>ValueStringBuilder</code> only has one internal <code>Span</code> as representation which can cause fragmentation on very big strings.</li>
82+
<li><code>StringBuilder</code> has a richer API as the <code>ValueStringBuilder</code>. In the future they should have the same amount of API's as the <code>StringBuilder</code> is the &quot;big brother&quot; of this package.</li>
83+
<li><code>ValueStringBuilder</code> has different API calls like <a href="xref:LinkDotNet.StringBuilder.ValueStringBuilder.IndexOf(ReadOnlySpan%7BSystem.Char%7D)"><code>IndexOf</code></a> or <a href="xref:LinkDotNet.StringBuilder.ValueStringBuilder.LastIndexOf(ReadOnlySpan%7BSystem.Char%7D)"><code>LastIndexOf</code></a>.</li>
84+
</ul>
85+
<h2 id="benchmark">Benchmark</h2>
86+
<p>The following table gives you a small comparison between the <code>StringBuilder</code> which is part of .NET and the <code>ValueStringBuilder</code>:</p>
87+
<pre><code>BenchmarkDotNet v0.14.0, macOS Sequoia 15.3.1 (24D70) [Darwin 24.3.0]
88+
Apple M2 Pro, 1 CPU, 12 logical and 12 physical cores
89+
.NET SDK 9.0.200
90+
[Host] : .NET 9.0.2 (9.0.225.6610), Arm64 RyuJIT AdvSIMD
91+
DefaultJob : .NET 9.0.2 (9.0.225.6610), Arm64 RyuJIT AdvSIMD
92+
93+
94+
| Method | Mean | Error | StdDev | Ratio | Gen0 | Allocated | Alloc Ratio |
95+
|-------------------- |----------:|---------:|---------:|------:|-------:|----------:|------------:|
96+
| DotNetStringBuilder | 126.74 ns | 0.714 ns | 0.667 ns | 1.00 | 0.1779 | 1488 B | 1.00 |
97+
| ValueStringBuilder | 95.69 ns | 0.118 ns | 0.110 ns | 0.76 | 0.0669 | 560 B | 0.38 |
98+
</code></pre>
99+
<p>For more comparison check the documentation.</p>
100+
<p>Another benchmark shows that this <code>ValueStringBuilder</code> uses less memory when it comes to appending <code>ValueTypes</code> such as <code>int</code>, <code>double</code>, ...</p>
101+
<pre><code>| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
102+
|------------------------------- |---------:|--------:|--------:|-------:|-------:|----------:|
103+
| ValueStringBuilderAppendFormat | 821.7 ns | 1.29 ns | 1.14 ns | 0.4330 | - | 3.54 KB |
104+
| StringBuilderAppendFormat | 741.5 ns | 5.58 ns | 5.22 ns | 0.9909 | 0.0057 | 8.1 KB |
105+
106+
</code></pre>
107+
<p>Checkout the <a href="https://github.com/linkdotnet/StringBuilder/tree/main/tests/LinkDotNet.StringBuilder.Benchmarks">Benchmark</a> for more detailed comparison and setup.</p>
108+
</article>
109+
</div>
110+
111+
<div class="hidden-sm col-md-2" role="complementary">
112+
<div class="sideaffix">
113+
<div class="contribution">
114+
<ul class="nav">
115+
<li>
116+
<a href="https://github.com/linkdotnet/StringBuilder/blob/stable/docs/site/articles/comparison.md/#L1" class="contribution-link">Improve this Doc</a>
117+
</li>
118+
</ul>
119+
</div>
120+
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
121+
<h5>In This Article</h5>
122+
<div></div>
123+
</nav>
124+
</div>
125+
</div>
126+
</div>
127+
</div>
128+
</div>
129+
130+
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
131+
<script type="text/javascript" src="../styles/docfx.js"></script>
132+
<script type="text/javascript" src="../styles/main.js"></script>
133+
</body>
134+
</html>

articles/concepts.html

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!DOCTYPE html>
2+
<!--[if IE]><![endif]-->
3+
<html>
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8+
<title>How does it work? | ValueStringBuilder </title>
9+
<meta name="viewport" content="width=device-width">
10+
<meta name="title" content="How does it work? | ValueStringBuilder ">
11+
<meta name="generator" content="docfx 2.59.4.0">
12+
<meta name="description" content="The ValueStringBuilder is a fast and low allocating StringBuilder meant for scenarios where every allocation and millisecond is important.">
13+
<link rel="shortcut icon" href="../images/logo.png">
14+
<link rel="stylesheet" href="../styles/docfx.vendor.css">
15+
<link rel="stylesheet" href="../styles/docfx.css">
16+
<link rel="stylesheet" href="../styles/main.css">
17+
<meta property="docfx:navrel" content="../toc.html">
18+
<meta property="docfx:tocrel" content="toc.html">
19+
20+
<meta property="docfx:rel" content="../">
21+
22+
</head>
23+
<body data-spy="scroll" data-target="#affix" data-offset="120">
24+
<div id="wrapper">
25+
<header>
26+
27+
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
28+
<div class="container">
29+
<div class="navbar-header">
30+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
31+
<span class="sr-only">Toggle navigation</span>
32+
<span class="icon-bar"></span>
33+
<span class="icon-bar"></span>
34+
<span class="icon-bar"></span>
35+
</button>
36+
37+
<a class="navbar-brand" href="../index.html">
38+
<img id="logo" class="svg" src="../images/logo.png" alt="ValueStringBuilder">
39+
</a>
40+
</div>
41+
<div class="collapse navbar-collapse" id="navbar">
42+
<form class="navbar-form navbar-right" role="search" id="search">
43+
<div class="form-group">
44+
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
45+
</div>
46+
</form>
47+
</div>
48+
</div>
49+
</nav>
50+
</header>
51+
<div class="container body-content">
52+
53+
<div id="search-results">
54+
<div class="search-list">Search Results for <span></span></div>
55+
<div class="sr-items">
56+
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
57+
</div>
58+
<ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
59+
</div>
60+
</div>
61+
<div role="main" class="container body-content hide-when-search">
62+
63+
<div class="sidenav hide-when-search">
64+
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
65+
<div class="sidetoggle collapse" id="sidetoggle">
66+
<div id="sidetoc"></div>
67+
</div>
68+
</div>
69+
<div class="article row grid-right">
70+
<div class="col-md-10">
71+
<article class="content wrap" id="_content" data-uid="">
72+
<h1 id="how-does-it-work">How does it work?</h1>
73+
74+
<p>Before I answer the question, I would like to raise another question: How does it work differently and more effectively than the current <code>StringBuilder</code>?</p>
75+
<p>The basic idea is to use a <code>ref struct</code> which enforces that the <code>ValueStringBuilder</code> will live on the <strong>stack</strong> instead of the <strong>heap</strong>.
76+
Furthermore, we try to use advanced features like <code>Span&lt;T&gt;</code> and <code>ArrayPool</code> to reduce allocations even further. Because of the way C# / .NET is optimized for those types the <code>ValueStringBuilder</code> gains a lot of speed with low allocations.
77+
With this approach, some limitations arise. Head over to the <a class="xref" href="known_limitations.html">known limitation</a> to know more.</p>
78+
<h2 id="resources">Resources:</h2>
79+
<p><a href="https://steven-giesel.com/blogPost/4cada9a7-c462-4133-ad7f-e8b671987896">Here</a> is my detailed blog post about some of the implementation details.</p>
80+
</article>
81+
</div>
82+
83+
<div class="hidden-sm col-md-2" role="complementary">
84+
<div class="sideaffix">
85+
<div class="contribution">
86+
<ul class="nav">
87+
<li>
88+
<a href="https://github.com/linkdotnet/StringBuilder/blob/stable/docs/site/articles/concepts.md/#L1" class="contribution-link">Improve this Doc</a>
89+
</li>
90+
</ul>
91+
</div>
92+
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
93+
<h5>In This Article</h5>
94+
<div></div>
95+
</nav>
96+
</div>
97+
</div>
98+
</div>
99+
</div>
100+
</div>
101+
102+
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
103+
<script type="text/javascript" src="../styles/docfx.js"></script>
104+
<script type="text/javascript" src="../styles/main.js"></script>
105+
</body>
106+
</html>

0 commit comments

Comments
 (0)