justinamiller / Litestringbuilder
Licence: mit
Alternative to the System.Text.StringBuilder C# class.
Stars: ✭ 48
Projects that are alternatives of or similar to Litestringbuilder
Util
A collection of useful utility functions
Stars: ✭ 201 (+318.75%)
Mutual labels: string, string-manipulation
Mightystring
Making Ruby Strings Powerful
Stars: ✭ 28 (-41.67%)
Mutual labels: string, string-manipulation
Superstring.py
A fast and memory-optimized string library for heavy-text manipulation in Python
Stars: ✭ 231 (+381.25%)
Mutual labels: string, string-manipulation
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-85.42%)
Mutual labels: string, string-manipulation
safe-string-interpolation
A type driven approach to string interpolation, aiming at consistent, secure, and only-human-readable logs and console outputs !
Stars: ✭ 14 (-70.83%)
Mutual labels: string, string-manipulation
Voca rs
Voca_rs is the ultimate Rust string library inspired by Voca.js, string.py and Inflector, implemented as independent functions and on Foreign Types (String and str).
Stars: ✭ 167 (+247.92%)
Mutual labels: string, string-manipulation
node-red-contrib-string
Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.
Stars: ✭ 15 (-68.75%)
Mutual labels: string, string-manipulation
stringext
Extra string functions for OCaml
Stars: ✭ 20 (-58.33%)
Mutual labels: string, string-manipulation
normalize-text
📝 Provides a simple API to normalize texts, whitespaces, paragraphs & diacritics.
Stars: ✭ 54 (+12.5%)
Mutual labels: string, string-manipulation
Androidlibrary
Android library to reveal or obfuscate strings and assets at runtime
Stars: ✭ 162 (+237.5%)
Mutual labels: string, string-manipulation
Portable Utf8
🉑 Portable UTF-8 library - performance optimized (unicode) string functions for php.
Stars: ✭ 405 (+743.75%)
Mutual labels: string, string-manipulation
Str
A fast, solid and strong typed string manipulation library with multibyte support
Stars: ✭ 199 (+314.58%)
Mutual labels: string, string-manipulation
Strman Java
A Java 8 string manipulation library.
Stars: ✭ 1,362 (+2737.5%)
Mutual labels: string, string-manipulation
split-on-first
Split a string on the first occurrence of a given separator
Stars: ✭ 68 (+41.67%)
Mutual labels: string, string-manipulation
Tiny Utf8
Unicode (UTF-8) capable std::string
Stars: ✭ 322 (+570.83%)
Mutual labels: string, string-manipulation
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-27.08%)
Mutual labels: string, string-manipulation
String
Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way.
Stars: ✭ 709 (+1377.08%)
Mutual labels: string
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (+1235.42%)
Mutual labels: string-manipulation
LiteStringBuilder
An alternative to the System.Text.StringBuilder C# class.
Why?
Because System.Text.StringBuilder does actually a lot of memory allocation when appending string, very often it's just not better than a direct string concat.
Performance
Framework 4.8
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
[Host] : .NET Framework 4.8 (4.8.4042.0), X86 LegacyJIT
Job-GLVCMQ : .NET Framework 4.8 (4.8.4042.0), X86 LegacyJIT
Runtime=.NET 4.8
Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|
String_Added | 613.7 ns | 12.02 ns | 11.24 ns | 0.0725 | - | - | 345 B |
String_Concat | 619.3 ns | 6.88 ns | 5.37 ns | 0.0858 | - | - | 408 B |
LiteStringBuilder | 738.3 ns | 13.77 ns | 12.88 ns | 0.0429 | - | - | 204 B |
String_Interpolated | 740.5 ns | 7.73 ns | 7.23 ns | 0.0782 | - | - | 369 B |
StringBuilder | 823.9 ns | 16.27 ns | 14.43 ns | 0.1116 | - | - | 529 B |
Large_LiteStringBuilder | 13,043.1 ns | 79.89 ns | 62.37 ns | 1.7242 | - | - | 8192 B |
Large_String_Concat | 15,707.7 ns | 813.10 ns | 798.58 ns | 3.3875 | - | - | 16077 B |
Large_String_Interpolated | 16,491.2 ns | 382.03 ns | 1,108.35 ns | 3.4027 | - | - | 16132 B |
Large_String_Added | 17,051.5 ns | 255.97 ns | 226.91 ns | 3.3875 | - | - | 16077 B |
Large_StringBuilder | 33,344.6 ns | 652.89 ns | 1,035.56 ns | 6.0425 | - | - | 28699 B |
Core 3.0
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.17763.775 (1809/October2018Update/Redstone5)
Intel Core i9-9880H CPU 2.30GHz, 1 CPU, 8 logical and 8 physical cores
.NET Core SDK=3.0.100
[Host] : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT
Job-OQEAOY : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT
Runtime=.NET Core 3.0
Method | Mean | Error | StdDev | Median | Gen 0 | Gen 1 | Allocated |
---|---|---|---|---|---|---|---|
String_Added | 458.7 ns | 3.58 ns | 3.35 ns | 457.7 ns | 0.0467 | - | 392 B |
LiteStringBuilder | 505.3 ns | 10.04 ns | 9.86 ns | 501.2 ns | 0.0410 | - | 344 B |
String_Concat | 538.9 ns | 13.65 ns | 38.29 ns | 527.1 ns | 0.0668 | - | 560 B |
String_Interpolated | 609.5 ns | 12.06 ns | 12.39 ns | 603.9 ns | 0.0448 | - | 376 B |
StringBuilder | 682.1 ns | 15.40 ns | 23.51 ns | 677.2 ns | 0.0544 | - | 456 B |
Large_LiteStringBuilder | 8,930.6 ns | 175.61 ns | 180.34 ns | 8,869.1 ns | 0.9766 | 0.0153 | 8208 B |
Large_String_Concat | 12,359.0 ns | 214.07 ns | 200.24 ns | 12,350.1 ns | 1.9073 | 0.0763 | 16048 B |
Large_String_Interpolated | 12,612.2 ns | 189.40 ns | 177.17 ns | 12,607.5 ns | 1.9226 | 0.0610 | 16112 B |
Large_String_Added | 12,776.4 ns | 296.47 ns | 549.52 ns | 12,611.3 ns | 1.9073 | 0.0763 | 16048 B |
Large_StringBuilder | 30,215.0 ns | 569.50 ns | 504.85 ns | 30,011.7 ns | 3.4485 | 0.1831 | 28952 B |
Supported Platforms
Currently;
- .Net Framework 4.0+
- .Net Standard 1.3+
How do I use it?
We got your samples right here
Install the Nuget package like this;
PM> Install-Package >LiteStringBuilder
Or reference the LiteStringBuilder.dll assembly that matches your app's platform.
Creating LiteStringBuilder
using StringHelper;
//create through instance
var sb = new LiteStringBuilder();
//or through static call (will create a new instance)
var sb = LiteStringBuilder.Create();
//Can create instance with buffer pool size
var sb = new LiteStringBuilder(500);
//Can create instance with initial string value.
var sb = new LiteStringBuilder("Hello World");
Using LiteStringBuilder
//Retrieve an instance from the pool
var sb = LiteStringBuilder.Create();
sb.Append("Cost: ").Append(32.11).Append(" Sent: ").Append(false);
//Return instance of string;
sb.ToString();
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].