Repository navigation
Add IFileSystem.SourceFileReadShim returning char[] - #4948
auduchinok wants to merge 2 commits into
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. |
|
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 returningStreamwhich is read tostringwhich 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.