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

Misc more optimisations #883

Merged
merged 8 commits into from
Jun 29, 2022
Merged

Conversation

jonludlam
Copy link
Member

A few more optimisations and fixes. Again, based on the previous PRs.

Copy link
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

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

What is supposed to be in the "Get rid of unresolved paths in docs" commit ?

Otherwise, I think it's ready to merge :)

@@ -93,7 +93,7 @@ and extension env parent t =
}
in
let type_path = type_path env t.type_path in
let constructors = List.map constructor t.constructors in
let constructors = List.rev_map constructor t.constructors |> List.rev in
Copy link
Collaborator

Choose a reason for hiding this comment

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

I doubt these are useful to reduce stack trace sizes. (constructors, field, type/class argument). However, it might be a good idea for signature items.

Copy link
Member Author

Choose a reason for hiding this comment

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

They all make it harder to read, even if they aren't particularly long lists, so I did a whole load of them.

@jonludlam
Copy link
Member Author

That docs commit isn't particularly obvious! It's actually because odoc sometimes gets a bit confused when looking at cmt files where the 'wrong' type has been inferred - in particular if the compiler has decided a type is from a hidden module directly (ie, not going via a module with a canonical tag). So that commit adds an mli file (which is the preferred way to fix these sorts of issues) and adds a type annotation to persuade the compiler of the correct type to assign the function.

@Julow
Copy link
Collaborator

Julow commented Jun 29, 2022

I see, thanks.

fun ~mark_substituted env sg subs ->
let open ResultMonad in
List.fold_left
(fun sg_opt sub ->
sg_opt >>= fun sg -> fragmap ~mark_substituted env sub sg)
(Ok sg) subs

and assert_not_functor :
type err. expansion -> (Component.Signature.t, err) Result.t = function
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type err. expansion -> (Component.Signature.t, err) Result.t = function
type err. expansion -> (Component.Signature.t, err) Result.result = function

Compat with 4.02. Also, formatting is needed.

This helps in particular when analysing with e.g. magic-trace
This was originally to 'dedup' paths, but since they're no longer
as large as they were before we don't need to do this. Applies
to both compile.ml and link.ml
Since the change to stop round-tripping signatures through components
this is now useless
It wasn't being used and it slowed things down.
@jonludlam jonludlam force-pushed the misc-more-optimisations branch from 29d6329 to a043692 Compare June 29, 2022 16:02
@jonludlam jonludlam merged commit e300c9f into ocaml:master Jun 29, 2022
mseri pushed a commit to ocaml/opam-repository that referenced this pull request Dec 13, 2022
CHANGES:

Additions
- New unstable option `--as-json` for the HTML renderer that emits HTML
  fragments (preamble, content) together with metadata (table of contents,
  breadcrumbs, whether katex is used) in JSON format. (@sabine, ocaml/odoc#908)
- New maths support via `{m ... }` and `{math ... }` tags. (@giltho, @gpetiot, ocaml/odoc#886)
- Various optimisations (@jonludlam, ocaml/odoc#870, ocaml/odoc#883)
- Better handling of alerts and deprecation notices. (@panglesd, ocaml/odoc#828)
- Handle language tags on code blocks (@Julow, ocaml/odoc#848)

Bugfixes
- Shadowing issues (@jonludlam, ocaml/odoc#853)
- Layout fixes and improvements (@panglesd, ocaml/odoc#832, ocaml/odoc#839, ocaml/odoc#847)
- Handle comments on class constraints and inherit (@Julow, ocaml/odoc#844)
- Disable the missing root warning (@jonludlam, ocaml/odoc#881)
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.

2 participants