Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dap): remove unnecessary intermediate type #8018

Merged

Conversation

rgrinberg
Copy link
Member

@rgrinberg rgrinberg commented Jun 20, 2023

We have the following type:

type t =
  | File of Path.t
  | Glob of Path.t * Glob.t

That is exactly the same type as what we use to represent
dune-action-plugin dependencies except it uses typed paths [Path.t]
instead of raw strings like the dune-action-plugin

It was used as an intermediate stage when converting DAP dependencies
into dune dependencies. So previously, the conversions would go as:

DAP with string paths -> DAP with Path.t -> Dep.Set.t

The intermediate stage is unnecessary, and now we just convert:

DAP with string paths -> Dep.Set.t

The new code is both shorter, simpler, and faster.

Signed-off-by: Rudi Grinberg me@rgrinberg.com

We have the followin type:

```ocaml
type t =
  | File of Path.t
  | Glob of Path.t * Glob.t
```

That is exactly the same type as what we use to represent
dune-action-plugin dependencies except it uses typed paths [Path.t]
instead of raw strings like the dune-action-plugin

It was used as an intermediate stage when converting DAP dependencies
into dune dependencies. So previously, the conversions would go as:

```
DAP with string paths -> DAP with Path.t -> Dep.Set.t
```

The intermediate stage is unnecessary, and now we just convert:

```
DAP with string paths -> Dep.Set.t
```

The new code is both shorter, simpler, and faster.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: c3c2fac8-92fe-43c4-94f7-25dd1b51a8e3 -->
@rgrinberg rgrinberg requested a review from snowleopard June 20, 2023 20:40
@Alizter
Copy link
Collaborator

Alizter commented Jun 20, 2023

Looks good, any numbers on the "faster"?

Copy link
Collaborator

@snowleopard snowleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@rgrinberg rgrinberg merged commit aa75e75 into main Jun 22, 2023
@rgrinberg rgrinberg deleted the ps/rr/refactor_dap___remove_unnecessary_intermediate_type branch June 22, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants