digitalmars.D - An easy phobos i/o bug to fix
- Steven Schveighoffer (6/6) Jul 27 2020 If anyone is using windows and std.stdio.File.rawWrite, it's insanely
- starcanopy (4/10) Jul 28 2020 So, upon opening a File, save the mode into a field, and only
- Steven Schveighoffer (6/17) Jul 28 2020 Almost! I was thinking to store the current mode, and then only change
- starcanopy (17/35) Jul 28 2020 Looks like the contents of the Windows' version needs to be put
- starcanopy (4/19) Jul 28 2020 You could also just have a boolean member, e.g. binaryMode,
- Avrina (3/8) Jul 28 2020 This is the reason why.
- Steven Schveighoffer (9/19) Jul 28 2020 Because I don't use Windows? I'm sure there are a lot who do.
If anyone is using windows and std.stdio.File.rawWrite, it's insanely slow. And it's an easy fix. See https://issues.dlang.org/show_bug.cgi?id=7033 I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it. -Steve
Jul 27 2020
On Monday, 27 July 2020 at 15:19:44 UTC, Steven Schveighoffer wrote:If anyone is using windows and std.stdio.File.rawWrite, it's insanely slow. And it's an easy fix. See https://issues.dlang.org/show_bug.cgi?id=7033 I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it. -SteveSo, upon opening a File, save the mode into a field, and only execute the current behavior iff the mode isn't binary?
Jul 28 2020
On 7/28/20 7:24 PM, starcanopy wrote:On Monday, 27 July 2020 at 15:19:44 UTC, Steven Schveighoffer wrote:Almost! I was thinking to store the current mode, and then only change the mode when needed, including the required flush. This way, subsequent rawWrite calls are less expensive, even if it was open originally for text mode. -SteveIf anyone is using windows and std.stdio.File.rawWrite, it's insanely slow. And it's an easy fix. See https://issues.dlang.org/show_bug.cgi?id=7033 I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it.So, upon opening a File, save the mode into a field, and only execute the current behavior iff the mode isn't binary?
Jul 28 2020
On Wednesday, 29 July 2020 at 02:18:44 UTC, Steven Schveighoffer wrote:On 7/28/20 7:24 PM, starcanopy wrote:Looks like the contents of the Windows' version needs to be put into an if statement if I'm correctly following you. version (Windows) { import std.algorithm: canFind; /* currMode is a member of File I'd imagine, unless the value being assigned to currMode is normalized, canFind or something similar would be preferable over exhaustive checking. */ if (!currMode.canFind("b")) { // current behavior } } // writeOn Monday, 27 July 2020 at 15:19:44 UTC, Steven Schveighoffer wrote:Almost! I was thinking to store the current mode, and then only change the mode when needed, including the required flush. This way, subsequent rawWrite calls are less expensive, even if it was open originally for text mode. -SteveIf anyone is using windows and std.stdio.File.rawWrite, it's insanely slow. And it's an easy fix. See https://issues.dlang.org/show_bug.cgi?id=7033 I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it.So, upon opening a File, save the mode into a field, and only execute the current behavior iff the mode isn't binary?
Jul 28 2020
On Wednesday, 29 July 2020 at 03:08:43 UTC, starcanopy wrote:Looks like the contents of the Windows' version needs to be put into an if statement if I'm correctly following you. version (Windows) { import std.algorithm: canFind; /* currMode is a member of File I'd imagine, unless the value being assigned to currMode is normalized, canFind or something similar would be preferable over exhaustive checking. */ if (!currMode.canFind("b")) { // current behavior } } // writeYou could also just have a boolean member, e.g. binaryMode, present in only the Windows compilation that is true iff the mode in which the file was opened specified a binary mode.
Jul 28 2020
On Monday, 27 July 2020 at 15:19:44 UTC, Steven Schveighoffer wrote:I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it. -SteveThis should be an easy change and I'm kind of surprised this has been open for so long.This is the reason why.
Jul 28 2020
On 7/28/20 7:44 PM, Avrina wrote:On Monday, 27 July 2020 at 15:19:44 UTC, Steven Schveighoffer wrote:I don't use Windows, so I probably won't get around to fixing this. But ping me if you make a PR, I will review it.Because I don't use Windows? I'm sure there are a lot who do. Perhaps they don't use rawWrite very much? I would say the likely reason is because people who care about performance don't use std.stdio ;) In any case, it's not a good excuse for such a horrendous performance bug to be there for so long. Ironically, rawWrite should be as fast as possible because you are not rewriting newlines, but instead it eliminates all buffering. -SteveThis should be an easy change and I'm kind of surprised this has been open for so long.This is the reason why.
Jul 28 2020