Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
5222-dialyzer_typesig-Optimize-lookup_type-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5222-dialyzer_typesig-Optimize-lookup_type-2.patch of Package erlang
From c36afb8996b3851d907acc46fe8c3ba9ff6c5a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Thu, 3 Nov 2022 14:11:57 +0100 Subject: [PATCH 2/3] dialyzer_typesig: Optimize lookup_type/2 This function is called very frequently. Use the map syntax instead of calling the `maps` module. While at it, remove ancient out-commented code. --- lib/dialyzer/src/dialyzer_typesig.erl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index 2224ec8dba..0f08ea560e 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -2391,20 +2391,15 @@ unsafe_lookup_type(Key, Map) -> unsafe_lookup_type_list(List, Map) -> [unsafe_lookup_type(X, Map) || X <- List]. -lookup_type(Key, Map) when is_integer(Key) -> - case maps:find(Key, Map) of - error -> t_any(); - {ok, Val} -> Val - end; lookup_type(#fun_var{'fun' = Fun}, Map) -> Fun(Map); +lookup_type(Key, Map) when is_integer(Key) -> + case Map of + #{Key := Val} -> Val; + #{} -> t_any() + end; lookup_type(Key, Map) -> - %% Seems unused and dialyzer complains about it -- commented out. - %% case cerl:is_literal(Key) of - %% true -> t_from_term(cerl:concrete(Key)); - %% false -> t_subst(Key, Map). - %% end. mk_var(Var) -> case cerl:is_literal(Var) of -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor