Re: What are the best available D (not C) File input/output options?

2023-11-05 Thread confuzzled via Digitalmars-d-learn
On 11/3/23 2:30 AM, Steven Schveighoffer wrote: On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: You should use a buffering library like iopipe to write properly here (it handles the encoding of text for you). Thanks Steve, I will try that.

Re: What are the best available D (not C) File input/output options?

2023-11-05 Thread confuzzled via Digitalmars-d-learn
Good morning, First, thanks to you, Steve, and Julian for responding to my inquiry. On 11/3/23 4:59 AM, Sergey wrote: On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file w

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Sergey via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. In my experience I/O in D is quite slow. But you can try to improve it:

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I tried std.io but write() only outputs ubyte[] while I'm trying to output text so I abandoned idea early. Just specifically to answer this, this is so you understand this is what is going into the file -- bytes. You should use

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Julian Fondren via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. My naïve attempt to improve the situation pushed it over an hour and 15 m

What are the best available D (not C) File input/output options?

2023-11-02 Thread confuzzled via Digitalmars-d-learn
I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. My naïve attempt to improve the situation pushed it over an hour and 15 minutes. However, replacing std.stdio:File with core.stdc.stdio:F

Re: File Input

2017-05-14 Thread Ali Çehreli via Digitalmars-d-learn
On 05/13/2017 09:15 PM, JV wrote: > it doesn't pause and store but just keeps reading > > string studNum; > > readf("%s",&studNum); > write(studNum); That's the normal behavior for reading into strings. If you want to read to the end of the line, try this: import std.st

Re: File Input

2017-05-14 Thread k-five via Digitalmars-d-learn
On Sunday, 14 May 2017 at 04:15:02 UTC, JV wrote: Hey i'm not sure if i should create a new post for this but how should i fix this it doesn't pause and store but just keeps reading string studNum; readf("%s",&studNum); write(studNum); Can you say exactly what you ne

Re: File Input

2017-05-13 Thread JV via Digitalmars-d-learn
On Monday, 8 May 2017 at 10:34:42 UTC, k-five wrote: On Monday, 8 May 2017 at 10:22:53 UTC, JV wrote: On Monday, 8 May 2017 at 09:26:48 UTC, k-five wrote: On Monday, 8 May 2017 at 08:54:50 UTC, JV wrote: --- If I continue to learn D I will do b

Re: File Input

2017-05-08 Thread k-five via Digitalmars-d-learn
On Monday, 8 May 2017 at 10:22:53 UTC, JV wrote: On Monday, 8 May 2017 at 09:26:48 UTC, k-five wrote: On Monday, 8 May 2017 at 08:54:50 UTC, JV wrote: --- If I continue to learn D I will do but there is no guarantee and it got ready :) https://g

Re: File Input

2017-05-08 Thread JV via Digitalmars-d-learn
On Monday, 8 May 2017 at 09:26:48 UTC, k-five wrote: On Monday, 8 May 2017 at 08:54:50 UTC, JV wrote: [...] --- Do not worry. Your request is not rude. I give you a better tool. I finished to collect some examples in D and in a few days I will

Re: File Input

2017-05-08 Thread k-five via Digitalmars-d-learn
On Monday, 8 May 2017 at 08:54:50 UTC, JV wrote: On Sunday, 7 May 2017 at 16:40:50 UTC, k-five wrote: On Sunday, 7 May 2017 at 15:59:25 UTC, JV wrote: --- Do not worry. Your request is not rude. I give you a better tool. I finished to collect so

Re: File Input

2017-05-08 Thread JV via Digitalmars-d-learn
On Sunday, 7 May 2017 at 16:40:50 UTC, k-five wrote: On Sunday, 7 May 2017 at 15:59:25 UTC, JV wrote: [...] [...] -- You have the right for confusing :) there is many read and write names. But I assumed you are familiar w

Re: File Input

2017-05-07 Thread k-five via Digitalmars-d-learn
On Sunday, 7 May 2017 at 15:59:25 UTC, JV wrote: On Sunday, 7 May 2017 at 15:16:58 UTC, k-five wrote: On Sunday, 7 May 2017 at 13:57:47 UTC, JV wrote: I'm kinda getting it but how do i write the stored user input(string) varaible into a .txt??im getting confused since D has so many read and

Re: File Input

2017-05-07 Thread JV via Digitalmars-d-learn
On Sunday, 7 May 2017 at 15:16:58 UTC, k-five wrote: On Sunday, 7 May 2017 at 13:57:47 UTC, JV wrote: Hi guys I'd like to know how to get an input from the user to be stored in a .txt file using import std.file and is it possible to directly write in a .txt file without using a variable to s

Re: File Input

2017-05-07 Thread Suliman via Digitalmars-d-learn
On Sunday, 7 May 2017 at 13:57:47 UTC, JV wrote: Hi guys I'd like to know how to get an input from the user to be stored in a .txt file using import std.file and is it possible to directly write in a .txt file without using a variable to store the user input? Thanks for the answer in advanc

Re: File Input

2017-05-07 Thread k-five via Digitalmars-d-learn
On Sunday, 7 May 2017 at 13:57:47 UTC, JV wrote: Hi guys I'd like to know how to get an input from the user to be stored in a .txt file using import std.file and is it possible to directly write in a .txt file without using a variable to store the user input? Thanks for the answer in advanc

File Input

2017-05-07 Thread JV via Digitalmars-d-learn
Hi guys I'd like to know how to get an input from the user to be stored in a .txt file using import std.file and is it possible to directly write in a .txt file without using a variable to store the user input? Thanks for the answer in advance my mind is kinda jumbled about this since im ne

Re: d2 file input performance

2011-10-17 Thread Marco Leise
Am 04.09.2011, 19:01 Uhr, schrieb Christian Köstlin : On 9/3/11 7:53 , dennis luehring wrote: Am 26.08.2011 19:43, schrieb Christian Köstlin: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into k

Re: d2 file input performance

2011-09-04 Thread Christian Köstlin
On 9/3/11 7:53 , dennis luehring wrote: Am 26.08.2011 19:43, schrieb Christian Köstlin: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into kind of a problem. i wanted to read data from a file (or e

Re: d2 file input performance

2011-09-04 Thread Christian Köstlin
On 9/1/11 7:24 , David Nadlinger wrote: On 9/1/11 7:12 AM, Christian Köstlin wrote: Update: I added performance tests for ldc and gdc with the same programs. The results are interesting (please see the github page for the details). Oh wow, LDC must accidentally call some druntime functions fo

Re: d2 file input performance

2011-09-02 Thread dennis luehring
Am 26.08.2011 19:43, schrieb Christian Köstlin: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into kind of a problem. i wanted to read data from a file (or even better from a stream, but lets stay wi

Re: d2 file input performance

2011-08-31 Thread David Nadlinger
On 9/1/11 7:12 AM, Christian Köstlin wrote: Update: I added performance tests for ldc and gdc with the same programs. The results are interesting (please see the github page for the details). Oh wow, LDC must accidentally call some druntime functions for the ubyte[1] case, or something simila

Re: d2 file input performance

2011-08-31 Thread Christian Köstlin
Update: I added performance tests for ldc and gdc with the same programs. The results are interesting (please see the github page for the details). regards christian On 8/26/11 19:43 , Christian Köstlin wrote: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest

Re: d2 file input performance

2011-08-29 Thread Christian Köstlin
On 8/26/11 23:56 , bearophile wrote: Steven Schveighoffer: In fact, it would probably be faster. I suggest the OP to keep us updated on this matter. And later after some time, if no solutions are found, to bring the issue to the main D newsgroup and to Bugzilla too. This is a significant is

Re: d2 file input performance

2011-08-28 Thread Heywood Floyd
Christian Köstlin Wrote: > after some optimizing i got better, but was still way slower than c++. > so i started some small microbenchmarks regarding fileio: > https://github.com/gizmomogwai/performance in c++, java and d2. > > christian Hello! Thanks for you effort in putting this together!

Re: d2 file input performance

2011-08-26 Thread bearophile
Steven Schveighoffer: > In fact, it would probably be faster. I suggest the OP to keep us updated on this matter. And later after some time, if no solutions are found, to bring the issue to the main D newsgroup and to Bugzilla too. This is a significant issue. Bye, bearophile

Re: d2 file input performance

2011-08-26 Thread Steven Schveighoffer
On Fri, 26 Aug 2011 13:43:23 -0400, Christian Köstlin wrote: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into kind of a problem. i wanted to read data from a file (or even better from a st

d2 file input performance

2011-08-26 Thread Christian Köstlin
Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into kind of a problem. i wanted to read data from a file (or even better from a stream, but lets stay with file), byte-by-byte. the whole thing was p