mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Change IConsoleOutput.Write(string) overload parameter to ReadOnlySpan<char> Allows the caller more flexibility about choosing a buffer per use case. * NetOutput: Write StringBuilder directly to the std out text stream * Add EscSeqUtils.CSI_WriteCursorPosition Writes cursor position sequence to text writer without string allocation. * NetOutput: Skip cursor position escape sequence string allocation * Replace CSI_(Enable|Disable)MouseEvents static properties with readonly fields Changed for the sake of consistency with rest of the EscSegutils fields rather than performance. Also prevents bugs from accidentally setting the properties. * Use EscSeqUtils.CSI_Append(Foreground|Background)ColorRGB in v2 drivers * WindowsOutput SetCursorVisibility: Remove intermediate string builder * WindowsOutput.WriteToConsole: Use rented array as intermediate write buffer The large intermediate string builder remains a challenge. :) * NetOutput: Console.Out for the sake of consistency Also might have missed one of the Console.Out.Write(StringBuilder) calls... * Avoid Rune.ToString() in NetOutput.Write(IOutputBuffer) --------- Co-authored-by: Tig <tig@users.noreply.github.com>
32 lines
794 B
C#
32 lines
794 B
C#
using BenchmarkDotNet.Attributes;
|
|
using Tui = Terminal.Gui;
|
|
|
|
namespace Terminal.Gui.Benchmarks.ConsoleDrivers.EscSeqUtils;
|
|
|
|
[MemoryDiagnoser]
|
|
// Hide useless column from results.
|
|
[HideColumns ("writer")]
|
|
public class CSI_SetVsWrite
|
|
{
|
|
[Benchmark (Baseline = true)]
|
|
[ArgumentsSource (nameof (TextWriterSource))]
|
|
public TextWriter Set (TextWriter writer)
|
|
{
|
|
writer.Write (Tui.EscSeqUtils.CSI_SetCursorPosition (1, 1));
|
|
return writer;
|
|
}
|
|
|
|
[Benchmark]
|
|
[ArgumentsSource (nameof (TextWriterSource))]
|
|
public TextWriter Write (TextWriter writer)
|
|
{
|
|
Tui.EscSeqUtils.CSI_WriteCursorPosition (writer, 1, 1);
|
|
return writer;
|
|
}
|
|
|
|
public static IEnumerable<object> TextWriterSource ()
|
|
{
|
|
return [StringWriter.Null];
|
|
}
|
|
}
|