Skip to content

Commit

Permalink
Cleanup and benchmark refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
FlatlinerDOA committed May 12, 2024
1 parent a4ccb1f commit 6833603
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 94 deletions.
183 changes: 109 additions & 74 deletions README.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions benchmarks/CreateNewWithLength10.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ namespace Benchmarks;
[MemoryDiagnoser]
public class CreateNewWithLength10
{
private char[] array = new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

[Benchmark(Description ="string.ToRope()")]
public void RopeOfCharFromString() => _ = "0123456789".ToRope();

[Benchmark(Description = "new Rope<char>(array)")]
public void RopeOfCharFromArray() => _ = new Rope<char>(new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });
public void RopeOfCharFromArray() => _ = new Rope<char>(this.array);

[Benchmark(Description = "new List<char>(array)")]
public void ListOfCharFromArray() => _ = new List<char>(new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });
public void ListOfCharFromArray() => _ = new List<char>(this.array);

[Benchmark(Description = "new StringBuilder(string)")]
public void StringBuilder() => _ = new StringBuilder("0123456789");
Expand Down
26 changes: 13 additions & 13 deletions benchmarks/SplitThenConcat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ public class SplitThenConcat
[Params(10, 100, 1000)]
public int EditCount;

[Benchmark]
public void ListOfChar()
{
var s = new List<char>(BenchmarkData.LoremIpsum);
for (int i = 0; i < EditCount; i++)
{
s.RemoveRange(321, s.Count - 322); // = new StringBuilder(s.ToString()[..321]);
s.AddRange(BenchmarkData.LoremIpsum);
}

////s.ToString();
}

[Benchmark]
public void RopeOfChar()
{
Expand All @@ -50,4 +37,17 @@ public void StringBuilder()

////s.ToString();
}

[Benchmark]
public void ListOfChar()
{
var s = new List<char>(BenchmarkData.LoremIpsum);
for (int i = 0; i < EditCount; i++)
{
s.RemoveRange(321, s.Count - 322); // = new StringBuilder(s.ToString()[..321]);
s.AddRange(BenchmarkData.LoremIpsum);
}

////s.ToString();
}
}
Binary file modified benchmarks/results/Benchmarks.AddRange-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.CreateNewEmpty-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.CreateNewWithLength10-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.Equals-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.IndexOf-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.InsertRange-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmarks/results/Benchmarks.SplitThenConcat-barplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/Compare/Diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
namespace Rope.Compare;

using System;
using System.Drawing;

/// <summary>
/// Record struct representing one diff operation.
Expand Down
5 changes: 1 addition & 4 deletions tests/RopeConstructionTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
namespace Rope.UnitTests;

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


[TestClass]
public class RopeConstructionTests
Expand Down

0 comments on commit 6833603

Please sign in to comment.