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

Fix performance regression introduced in 4.08 #10624

Merged
merged 2 commits into from Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changes
Expand Up @@ -136,6 +136,10 @@ Working version
- #10559: Evaluate signature substitutions lazily
(Stephen Dolan, review by Leo White)

- #8776, #10624: Fix compilation time regression introduced in 4.08
(Nicolás Ojeda Bär, fix by Leo White, report by Alain Frisch, review by Thomas
Refis)

### Build system:

### Bug fixes:
Expand Down
27 changes: 16 additions & 11 deletions typing/typeopt.ml
Expand Up @@ -22,18 +22,23 @@ open Typedtree
open Lambda

let scrape_ty env ty =
let ty = Ctype.expand_head_opt env (Ctype.correct_levels ty) in
match get_desc ty with
| Tconstr (p, _, _) ->
begin match Env.find_type p env with
| {type_kind = ( Type_variant (_, Variant_unboxed)
| Type_record (_, Record_unboxed _) ); _} -> begin
match Typedecl_unboxed.get_unboxed_type_representation env ty with
| None -> ty
| Some ty2 -> ty2
end
| _ -> ty
| exception Not_found -> ty
| Tconstr _ ->
let ty = Ctype.expand_head_opt env (Ctype.correct_levels ty) in
begin match get_desc ty with
| Tconstr (p, _, _) ->
begin match Env.find_type p env with
| {type_kind = ( Type_variant (_, Variant_unboxed)
| Type_record (_, Record_unboxed _) ); _} -> begin
match Typedecl_unboxed.get_unboxed_type_representation env ty with
| None -> ty
| Some ty2 -> ty2
end
| _ -> ty
| exception Not_found -> ty
end
| _ ->
ty
end
| _ -> ty

Expand Down