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
Changes from 1 commit
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
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