Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
5621-beam_types-Improve-meet-2-performance-for-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5621-beam_types-Improve-meet-2-performance-for-tuples.patch of Package erlang
From 47ea26446117d46267f180a7c2ae5792f70e20d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Thu, 21 Apr 2022 14:40:48 +0200 Subject: [PATCH] beam_types: Improve meet/2 performance for tuples --- lib/compiler/src/beam_types.erl | 4 +-- lib/compiler/test/beam_validator_SUITE.erl | 42 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/compiler/src/beam_types.erl b/lib/compiler/src/beam_types.erl index 730af42424..88dd1a8428 100644 --- a/lib/compiler/src/beam_types.erl +++ b/lib/compiler/src/beam_types.erl @@ -23,7 +23,7 @@ -define(BEAM_TYPES_INTERNAL, true). -include("beam_types.hrl"). --import(lists, [foldl/3, reverse/1]). +-import(lists, [foldl/3, reverse/1, usort/1]). -export([meet/1, meet/2, join/1, join/2, subtract/2]). @@ -839,7 +839,7 @@ glb_tuples(#t_tuple{size=Sz1,exact=Ex1,elements=Es1}, end. glb_elements(Es1, Es2) -> - Keys = maps:keys(Es1) ++ maps:keys(Es2), + Keys = usort(maps:keys(Es1) ++ maps:keys(Es2)), glb_elements_1(Keys, Es1, Es2, #{}). glb_elements_1([Key | Keys], Es1, Es2, Acc) -> diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index 08ebec289f..02e4624fad 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -40,6 +40,7 @@ receive_marker/1,safe_instructions/1, missing_return_type/1,will_bif_succeed/1, bs_saved_position_units/1,parent_container/1, + container_performance/1, not_equal_inference/1]). -include_lib("common_test/include/ct.hrl"). @@ -75,6 +76,7 @@ groups() -> receive_marker,safe_instructions, missing_return_type,will_bif_succeed, bs_saved_position_units,parent_container, + container_performance, not_equal_inference]}]. init_per_suite(Config) -> @@ -962,6 +964,42 @@ pc_1(#pc{a=A}=R) -> pc_2(_R) -> ok. +%% GH-5915: The following function took an incredibly long time to validate. +container_performance(Config) -> + case Config of + ({b,_}) -> {k1}; + ({a,{b,_}}) -> {k2}; + ({a,{a,{b,_}}}) -> {k3}; + ({a,{a,{a,{b,_}}}}) -> {k4}; + ({a,{a,{a,{a,{b,_}}}}}) -> {k5}; + ({a,{a,{a,{a,{a,{b,_}}}}}}) -> {k6}; + ({a,{a,{a,{a,{a,{a,{b,_}}}}}}}) -> {k7}; + ({a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}) -> {k8}; + ({a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}) -> {k9}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}) -> {k10}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}) -> {k11}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}) -> {k12}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}) -> {k13}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}) -> {k14}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}}) -> {k15}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}}}) -> {k16}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}}}}) -> {k17}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,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,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}}}}}}}}}}}}}}}) -> {k28}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{b,_}}}}}}}}}}}}}}}}}}}}}}}}}}}}}) -> {k29}; + ({a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,{a,_}}}}}}}}}}}}}}}}}}}}}}}}}}}}}) -> {k30}; + _ -> ok + end. + %% OTP-18365: A brainfart in inference for '=/=' inverted the results. not_equal_inference(_Config) -> {'EXIT', {function_clause, _}} = (catch not_equal_inference_1(id([0]))), -- 2.34.1
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