Pre-submission Checklist
Problem Statement
Migrating from ImGuiNet to Hexa.NET we've noticed that there are no overloads accepting ReadOnlySpan<char>, this makes migration more complex than it potentially could be
Methods like Utils.EncodeStringUTF8 and Utils.GetByteCountUTF8 are also working only with strings, yet underlying Encoding.UTF8 method do have ReadOnlySpan<char> overloads.
Proposed Solution
Hexa.NET.Utilities
- add overloads to Utils accepting
ReadOnlySpan<char> - this is where the core logic will be moved
- existing methods working with
string will use AsSpan() extension method on supplied strings. It does not allocate
Hexa.NET.ImGui
- same approach, my current understanding is that it will require mostly manual work in
Manual/Functions/Functions.*.cs but please correct me if I am wrong
I have not digger deep enough yet into code generation part of the framework, I would assume same idea could be used there as well.
If you'll approve this I am happy to try to contribute
Alternatives Considered
Using ReadOnlySpan<byte> (and u8) is the most performant way of working with strings, but the tooling around it is very rough yet. If we're talking about software which tries to balance between convenience and performance, ReadOnlySpan<char> is usually the way to go.
Additional Context
No response
Pre-submission Checklist
Problem Statement
Migrating from ImGuiNet to Hexa.NET we've noticed that there are no overloads accepting
ReadOnlySpan<char>, this makes migration more complex than it potentially could beMethods like
Utils.EncodeStringUTF8andUtils.GetByteCountUTF8are also working only with strings, yet underlyingEncoding.UTF8method do haveReadOnlySpan<char>overloads.Proposed Solution
Hexa.NET.Utilities
ReadOnlySpan<char>- this is where the core logic will be movedstringwill useAsSpan()extension method on supplied strings. It does not allocateHexa.NET.ImGui
Manual/Functions/Functions.*.csbut please correct me if I am wrongI have not digger deep enough yet into code generation part of the framework, I would assume same idea could be used there as well.
If you'll approve this I am happy to try to contribute
Alternatives Considered
Using
ReadOnlySpan<byte>(and u8) is the most performant way of working with strings, but the tooling around it is very rough yet. If we're talking about software which tries to balance between convenience and performance,ReadOnlySpan<char>is usually the way to go.Additional Context
No response