-
Notifications
You must be signed in to change notification settings - Fork 183
New reader #506
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
Merged
Merged
New reader #506
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
4793787
replace fixed regex with regex properties and regex attributes
Hirogen 039b19b
Merge branch 'Development' into performance_optimizations
ffa5ecc
optimization, added ISpan stuff
f54bcc4
pipelines docs for implementation
76a42f2
Pipeline added
Hirogen 02108cd
Merge branch 'Development' into new_reader
2fbc998
pipelines update
90ef20b
locks
5040622
update reader
ea35028
chore: update plugin hashes [skip ci]
github-actions[bot] cceaa03
Update src/ColumnizerLib/ILogLineSpanColumnizer.cs
Hirogen a2e43ff
Update src/LogExpert.Core/Interface/ILogStreamReaderSpan.cs
Hirogen 0765822
Update src/LogExpert.UI/Controls/LogWindow/LogWindow.cs
Hirogen a76efa0
Update src/LogExpert.Core/Interface/ILogStreamReaderSpan.cs
Hirogen 91f5c30
Update src/LogExpert.Core/Classes/Log/LogBuffer.cs
Hirogen f846922
chore: update plugin hashes [skip ci]
github-actions[bot] 97808ba
Update src/ColumnizerLib/ITextValue.cs
Hirogen 433ba41
Update src/ColumnizerLib/ILogLine.cs
Hirogen 6a3b31d
review comments
Hirogen 262fab1
chore: update plugin hashes [skip ci]
github-actions[bot] f163dab
benchmakr summary
a039252
Merge branch 'new_reader' of https://github.com/LogExperts/LogExpert …
b28a006
chore: update plugin hashes [skip ci]
github-actions[bot] 3f8dde4
benchmark md updates
Hirogen 0a2f759
Merge branch 'new_reader' of https://github.com/LogExperts/LogExpert …
Hirogen 33fa73e
chore: update plugin hashes [skip ci]
github-actions[bot] 7051b8d
update
Hirogen 316370d
update new line search
Hirogen 3db95b1
more changes
Hirogen c795053
fixing no lines showing up
7e32496
filereader documentation
08db763
missing resources link
Hirogen 056c712
updates
Hirogen 3e7f15c
clear datagrid when exiting logexpert, for faster exit
d166500
added ReadOnlyMemory<char>
1e1e620
Memory
Hirogen 791beee
A lot of Memory
2d84ab1
fixed not showing any lines... now all is shown
Hirogen b3b95ac
memory, more memory, even more memory
Hirogen 1bbd7b5
fixing unittests
Hirogen 9c4a3d9
Merge branch 'Development' into new_reader
Hirogen 4e3bd3f
chore: update plugin hashes [skip ci]
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace ColumnizerLib; | ||
|
|
||
| public interface ILogLineMemory : ILogLine | ||
| { | ||
| ReadOnlyMemory<char> FullLineMemory { get; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| public interface ILogLineSpan | ||
| { | ||
| ReadOnlySpan<char> GetFullLineSpan (); | ||
|
|
||
| int LineNumber { get; } | ||
| } | ||
|
|
||
| public readonly ref struct LogLineSpan : ILogLineSpan | ||
Hirogen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| private readonly ReadOnlyMemory<char> _lineMemory; | ||
|
|
||
| public LogLineSpan (ReadOnlyMemory<char> lineMemory, int lineNumber) | ||
| { | ||
| _lineMemory = lineMemory; | ||
| LineNumber = lineNumber; | ||
| } | ||
|
|
||
| public static LogLineSpan Create (ReadOnlyMemory<char> lineMemory, int lineNumber) => new LogLineSpan(lineMemory, lineNumber); | ||
|
|
||
| public ReadOnlySpan<char> GetFullLineSpan () => _lineMemory.Span; | ||
|
|
||
| public int LineNumber { get; } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| namespace ColumnizerLib; | ||
|
|
||
| public interface ILogLineSpanColumnizer : ILogLineColumnizer | ||
| { | ||
| /// <summary> | ||
| /// Span-based version of SplitLine that avoids string allocations | ||
| /// </summary> | ||
| IColumnizedLogLine SplitLine (ILogLineColumnizerCallback callback, ReadOnlySpan<char> lineSpan, int lineNumber); | ||
|
|
||
| /// <summary> | ||
| /// Span-based timestamp extraction | ||
| /// </summary> | ||
| DateTime GetTimestamp (ILogLineColumnizerCallback callback, ReadOnlySpan<char> lineSpan, int lineNumber); | ||
|
|
||
| /// <summary> | ||
| /// Indicates if this columnizer supports span-based operations | ||
| /// </summary> | ||
| bool IsSpanSupported { get; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System.Buffers; | ||
|
|
||
| namespace ColumnizerLib; | ||
|
|
||
| /// <summary> | ||
| /// <para> | ||
| /// Implement this interface in your columnizer if you want to pre-process every line | ||
| /// directly when it's loaded from file system.</para> | ||
| /// <para> | ||
| /// You can also use this to drop lines. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// By implementing this interface with your Columnizer you get the ability to modify the | ||
| /// content of a log file right before it will be seen by LogExpert. | ||
| /// </para> | ||
| /// <para> | ||
| /// Note that the <see cref="PreProcessLine"/> | ||
| /// method is only used when loading a line from disk. Because of internal buffering a log line may | ||
| /// be read only once or multiple times. You have to ensure that the behaviour is consistent | ||
| /// for every call to <see cref="PreProcessLine"/> for a specific line. That's especially true | ||
| /// when dropping lines. Dropping a line changes the line count seen by LogExpert. That has implications | ||
| /// for things like bookmarks etc. | ||
| /// </para> | ||
| /// </remarks> | ||
| public interface IPreProcessColumnizerMemory : IPreProcessColumnizer | ||
| { | ||
| #region Public methods | ||
|
|
||
| /// <summary> | ||
| /// Memory-optimized preprocessing method that returns <see cref="ReadOnlyMemory{T}"/> to avoid string allocations. | ||
| /// </summary> | ||
| /// <param name="logLine">Line content as ReadOnlyMemory</param> | ||
| /// <param name="lineNum">Line number as seen by LogExpert</param> | ||
| /// <param name="realLineNum">Actual line number in the file</param> | ||
| /// <returns>The changed content as <see cref="ReadOnlyMemory{T}"/>, the original memory if unchanged, or <see cref="ReadOnlyMemory{T}"/>.Empty to drop the line </returns> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// Return values: | ||
| /// - Original memory: Line unchanged, no allocation | ||
| /// - <see cref="ReadOnlyMemory{T}"/>.Empty: Drop the line | ||
| /// - New memory: Modified line content | ||
| /// </para> | ||
| /// <para> | ||
| /// When creating modified content, consider using <see cref="ArrayPool{T}"/> to reduce allocations | ||
| /// for temporary buffers, but the returned memory must be owned (not pooled). | ||
| /// </para> | ||
| /// </remarks> | ||
| /// | ||
| ReadOnlyMemory<char> PreProcessLine (ReadOnlyMemory<char> logLine, int lineNum, int realLineNum); | ||
|
|
||
| #endregion | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,22 @@ | ||
| namespace ColumnizerLib; | ||
|
|
||
| // DEPRECATED: This interface adds no value and causes performance overhead. | ||
| // Keep for backward compatibility but mark as obsolete. | ||
| [Obsolete("ITextValue is deprecated. Access FullLine or FullValue directly instead.", false)] | ||
| public interface ITextValue | ||
| { | ||
| #region Properties | ||
|
|
||
| string Text { get; } | ||
|
|
||
| #endregion | ||
| } | ||
|
|
||
| public static class TextValueExtensions | ||
| { | ||
| [Obsolete("Use ILogLine.FullLine property directly instead of this extension method")] | ||
| public static string GetText (this ILogLine logLine) => logLine.FullLine; | ||
|
|
||
| [Obsolete("Use DisplayValue property directly")] | ||
| public static string GetText (this IColumn column) => column.DisplayValue; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| namespace ColumnizerLib; | ||
|
|
||
| /// <summary> | ||
| /// Represents a single log line, including its full text and line number. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// <b>Purpose:</b> <br/> | ||
| /// The <c>LogLine</c> struct encapsulates the content and line number of a log entry. It is used throughout the | ||
| /// columnizer and log processing infrastructure to provide a strongly-typed, immutable representation of a log line. | ||
| /// </para> | ||
| /// <para> | ||
| /// <b>Usage:</b> <br/> | ||
| /// This struct implements the <see cref="ILogLine"/> interface, allowing it to be used wherever an <c>ILogLine</c> | ||
| /// is expected. It provides value semantics and is intended to be lightweight and efficiently passed by value. | ||
| /// </para> | ||
| /// <para> | ||
| /// <b>Relationship to ILogLine:</b> <br/> | ||
| /// <c>LogLine</c> is a concrete, immutable implementation of the <see cref="ILogLine"/> interface, providing | ||
| /// properties for the full line text and its line number. | ||
| /// </para> | ||
| /// <para> | ||
| /// <b>Why struct instead of record:</b> <br/> | ||
| /// A <c>struct</c> is preferred over a <c>record</c> here to avoid heap allocations and to provide value-type | ||
| /// semantics, which are beneficial for performance when processing large numbers of log lines. The struct is | ||
| /// immutable (readonly), ensuring thread safety and predictability. The previous <c>record</c> implementation | ||
| /// was replaced to better align with these performance and semantic requirements. | ||
| /// </para> | ||
| /// </remarks> | ||
| public class LogLine : ILogLineMemory | ||
| { | ||
| public string FullLine { get; } | ||
|
|
||
| public int LineNumber { get; } | ||
|
|
||
| public string Text { get; } | ||
|
|
||
| public ReadOnlyMemory<char> FullLineMemory { get; } | ||
|
|
||
| public ReadOnlyMemory<char> TextMemory { get; } | ||
|
|
||
| public LogLine (string fullLine, int lineNumber) | ||
| { | ||
| FullLine = fullLine; | ||
| LineNumber = lineNumber; | ||
| FullLineMemory = fullLine.AsMemory(); | ||
| TextMemory = fullLine.AsMemory(); | ||
| } | ||
|
|
||
| public LogLine (ReadOnlyMemory<char> fullLine, int lineNumber) | ||
| { | ||
| FullLine = fullLine.ToString(); | ||
| LineNumber = lineNumber; | ||
| FullLineMemory = fullLine; | ||
| TextMemory = fullLine; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.