-
Notifications
You must be signed in to change notification settings - Fork 790
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
Add IFileSystem.SourceFileReadShim returning char[] #4948
Conversation
Anything I should change? |
Ping |
I'm not sure I'm grasping the changes so I'll put few questions/points to try having better understanding:
EDIT: actually, yes it saves some char[] to string to char[] conversions, we save call to this: https://github.com/Microsoft/visualfsharp/blob/75e435e74b81bb47c4a0ced11be0d7560d2a66ea/src/fsharp/UnicodeLexing.fs#L17-L18 it might be worth checking if there are remaining internal usage of StringAsLexbuf that could instead deal with char [] if available around. |
@auduchinok Unfortunately, to use spans here (which I agree would be great) would require us to figure out how to adopt them all-up in the compiler. They are only available in Given this, I think we should take this PR as-is (assuming it is approved) and then open a discussion about how to start using spans once F# 4.5 is fully released. Based on benchmarking we've done, there are places where copying can be reduced quite a bit, which implies that judicious use of Span could help. But as it stands, the majority of F# users may not see those benefits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good overall change, and should help with what was measured in #4881
Failed test: IDE Unit tests
|
@auduchinok, I'm guessing we should close this, what do you think? Kevin |
It's OK to close it, since APIs are changed a bit since then, thank you. I'll probably open another one if ever continue this work. |
Adds API allowing to pass
char[]
to be used by lexer instead of returningStream
which is read tostring
which is then thrown away with.ToCharArray()
.PR continues work by @smoothdeveloper in #4882 but is aimed at the file system shim clients.
It would be great to use
ReadOnlySpan<char>
(and probably make this API returnstring
) instead at some point.