August 25, 2021

On Wednesday, 25 August 2021 at 13:30:58 UTC, rushsteve1 wrote:

>

On Wednesday, 25 August 2021 at 06:23:37 UTC, Kagamin wrote:

>

You marked all functions inline?

If I did then it wasn't on purpose, I was only trying to mark the handful of helper functions as inline. If you know a solution to this, that would be greatly appreciated!

When you use an attribute with a colon after it, like you do on line 232 of trash.d:

pragma(inline):

Then it applies not just to the next declaration, but to all subsequent declarations in the same scope (which in this case is the entire rest of the module).

(Source: first paragraph in the "Attributes" section of the spec.)

To avoid this, just remove the colon.

To be honest, you could probably remove pragma(inline) from the program altogether and not notice a difference. A program like this is almost certainly going to be bottlenecked on IO long before function-call overhead makes a noticeable difference to performance.

August 25, 2021

On Wednesday, 25 August 2021 at 13:52:32 UTC, Paul Backus wrote:

>

To be honest, you could probably remove pragma(inline) from the program altogether and not notice a difference. A program like this is almost certainly going to be bottlenecked on IO long before function-call overhead makes a noticeable difference to performance.

Thanks for the help, I did end up just removing the pragma(inline) attributes. You're right, they're a premature optimization that doesn't really add anything. Compiler might inline them anyway, it's smarter than me :)

August 25, 2021

On Wednesday, 25 August 2021 at 13:30:36 UTC, rushsteve1 wrote:

>

trash-d tries to mimic rm's semantics as much as possible. It also unifies all the different trash-* commands that trash-cli provides into a single one with flags. One of my goals with trash-d was to make a simpler and smaller alternative to trash-cli.

That makes sense, thanks!

>

The only advantage that trash-cli has that I know of (aside from maturity at this point) is that it handles .Trash/ directories on separate drives/partitions while trash-d always moves to the one in the user's home. Both approaches are spec-compliant, so I opted for the simpler one.

I suggest investigating that as a future improvement. Not only is moving files within the same volume much faster (potentially an O(1) operation as opposed to having to read then write every byte of data), but it can also result in space savings (in the case of filesystem snapshots).

August 25, 2021

On Wednesday, 25 August 2021 at 18:37:33 UTC, Vladimir Panteleev wrote:

>

I suggest investigating that as a future improvement. Not only is moving files within the same volume much faster (potentially an O(1) operation as opposed to having to read then write every byte of data), but it can also result in space savings (in the case of filesystem snapshots).

You're entirely right. I made an initial pass at this a little while back, and decided (for the time being at least) that it would complicate trash-d quite a bit more than I wanted.

But it's something on my radar, and could be a very good feature to add at some point. I've opened a GitHub issue for discussing/tracking this, since I figured the D forums weren't the right place for such a discussion.

1 2
Next ›   Last »