Re: dirEntries removes entire branches of empty directories

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 November 2022 at 21:27:28 UTC, Ali Çehreli wrote: However, ftw performs about twice as fast as dirEntries Yes, `dirEntries` isn't as fast as it could be. Here is a directory iterator which tries to strictly not do more work than what it must:

Re: dirEntries removes entire branches of empty directories

2022-11-26 Thread Ali Çehreli via Digitalmars-d-learn
On 11/14/22 14:41, kdevel wrote: > the ftw version gets the whole information from readdir alone. Created an enhancement request: https://issues.dlang.org/show_bug.cgi?id=23512 Ali

Re: dirEntries removes entire branches of empty directories

2022-11-14 Thread kdevel via Digitalmars-d-learn
On Monday, 14 November 2022 at 21:05:01 UTC, kdevel wrote: [...] the runtimes are ftw : 98 ms, 470 ÎŒs, and 2 *beeep* dirEntries: 170 ms, 515 ÎŒs, and 2 *beeep* (to be continued) When I examine the process with strace it appears that the ftw version gets the whole information

Re: dirEntries removes entire branches of empty directories

2022-11-14 Thread kdevel via Digitalmars-d-learn
On Friday, 11 November 2022 at 16:00:12 UTC, Ali Çehreli wrote: On 11/11/22 05:13, kdevel wrote: > dmd -O compiled patched (see below!) version applied to /usr/bin on my > desktop > yields: > > ftw : 363 ms, 750 ÎŒs, and 5 [*] > dirEntries: 18 secs, 831 ms, 738 ÎŒs, and 3 [*] Great. I

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread Ali Çehreli via Digitalmars-d-learn
On 11/11/22 08:00, Ali Çehreli wrote: > It may have to do something with the performance of the hard disk. I meant "the reason you got a much better improvement" may have to do something with the performance differences of your hard disk and mine. Ali

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread Ali Çehreli via Digitalmars-d-learn
On 11/11/22 05:13, kdevel wrote: > dmd -O compiled patched (see below!) version applied to /usr/bin on my > desktop > yields: > > ftw : 363 ms, 750 ÎŒs, and 5 [*] > dirEntries: 18 secs, 831 ms, 738 ÎŒs, and 3 [*] Great. I did not use -O with my test. It may have to do something with the

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread kdevel via Digitalmars-d-learn
On Thursday, 10 November 2022 at 21:27:28 UTC, Ali Çehreli wrote: On 11/9/22 12:06, Ali Çehreli wrote: > I am using its sibling 'ftw' Now that we know that dirEntries works properly, I decided not to use ftw. However, ftw performs about twice as fast as dirEntries (despite some common code

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 12:06, Ali Çehreli wrote: > I am using its sibling 'ftw' Now that we know that dirEntries works properly, I decided not to use ftw. However, ftw performs about twice as fast as dirEntries (despite some common code in the implementation below). I am leaving it here in case somebody

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 10, 2022 at 07:07:33PM +, Imperatorn via Digitalmars-d-learn wrote: > On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: > > On 11/9/22 11:30, Vladimir Panteleev wrote: > > > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli > > > wrote: > > >> Running the

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for me: Does not happen for me today either. (?) I must have confused

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:59:57 UTC, Ali Çehreli wrote: On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 20:06:15 UTC, Ali Çehreli wrote: On 11/9/22 11:05, Ali Çehreli wrote: It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for the user! You can walk the tree but can't put the results into your local context!

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:05, Ali Çehreli wrote: > Can you think of a workaround to achieve that? Me, me, me! :) I've learned about the Posix function 'nftw' (but I am using its sibling 'ftw'). It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct DirIteratorImpl has different implementations for Windows, etc. Ali

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. 1) Create a directory: [...] That's not the behaviour I get in Windows. When I create the subdirectory, I see it even if it's empty

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread kdevel via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. My code runs in tmp (tmpfs). 2) Make a sub-directory: mkdir deleteme/a Running the program shows no output; 'a' is not visited as a directory entry. Was say strace/ltrace?

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: Running the program shows no output; 'a' is not visited as a directory entry. That's not what happens for me: ```d import std.exception; import std.file; import std.path; import std.stdio; void ls() { foreach (e;