From 9bb1b740b58ffcb038a0aaaab6f60214145c8513 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Mon, 6 Feb 2023 10:26:52 +0100 Subject: [PATCH] Disable thin lto for dev builds by default in template When changing something trivial in the hello world project created by `cargo pgx new`, it would take ~20 seconds to compile a dev build of the generated crate on my machine. This seemed way slower than it should be. It turns out that the thin LTO setting greatly inrceases compilation times. By disabling it, compilation time of the crate is only 1 second. As far as I can tell this setting was enabled initially as a workaround for this bug in Rust: https://github.com/rust-lang/rust/issues/50007 Since this bug has been fixed since Rust 1.62, and current stable Rust is version 1.67, this PR removes the workaround. --- cargo-pgx/src/templates/cargo_toml | 1 - nix/templates/default/Cargo.toml | 1 - pgx-examples/aggregate/Cargo.toml | 1 - pgx-examples/bgworker/Cargo.toml | 1 - pgx-examples/bytea/Cargo.toml | 1 - pgx-examples/composite_type/Cargo.toml | 1 - pgx-examples/custom_sql/Cargo.toml | 1 - pgx-examples/custom_types/Cargo.toml | 1 - pgx-examples/errors/Cargo.toml | 1 - pgx-examples/nostd/Cargo.toml | 1 - pgx-examples/numeric/Cargo.toml | 1 - pgx-examples/operators/Cargo.toml | 1 - pgx-examples/pgtrybuilder/Cargo.toml | 1 - pgx-examples/schemas/Cargo.toml | 1 - pgx-examples/shmem/Cargo.toml | 1 - pgx-examples/spi/Cargo.toml | 1 - pgx-examples/spi_srf/Cargo.toml | 1 - pgx-examples/srf/Cargo.toml | 1 - pgx-examples/strings/Cargo.toml | 1 - pgx-examples/triggers/Cargo.toml | 1 - pgx-examples/versioned_so/Cargo.toml | 1 - 21 files changed, 21 deletions(-) diff --git a/cargo-pgx/src/templates/cargo_toml b/cargo-pgx/src/templates/cargo_toml index 18dc0459b..bc03792c5 100644 --- a/cargo-pgx/src/templates/cargo_toml +++ b/cargo-pgx/src/templates/cargo_toml @@ -23,7 +23,6 @@ pgx-tests = "=0.7.1" [profile.dev] panic = "unwind" -lto = "thin" [profile.release] panic = "unwind" diff --git a/nix/templates/default/Cargo.toml b/nix/templates/default/Cargo.toml index 44011f826..950c89d75 100644 --- a/nix/templates/default/Cargo.toml +++ b/nix/templates/default/Cargo.toml @@ -25,7 +25,6 @@ once_cell = "1.7.2" [profile.dev] panic = "unwind" -lto = "thin" [profile.release] panic = "unwind" diff --git a/pgx-examples/aggregate/Cargo.toml b/pgx-examples/aggregate/Cargo.toml index 07c66da9c..896abfa37 100644 --- a/pgx-examples/aggregate/Cargo.toml +++ b/pgx-examples/aggregate/Cargo.toml @@ -26,7 +26,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/bgworker/Cargo.toml b/pgx-examples/bgworker/Cargo.toml index 7e6bf392a..5c31dcfb2 100644 --- a/pgx-examples/bgworker/Cargo.toml +++ b/pgx-examples/bgworker/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/bytea/Cargo.toml b/pgx-examples/bytea/Cargo.toml index 35ff70171..1ea925be2 100644 --- a/pgx-examples/bytea/Cargo.toml +++ b/pgx-examples/bytea/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/composite_type/Cargo.toml b/pgx-examples/composite_type/Cargo.toml index 80bce3d70..57e20675c 100644 --- a/pgx-examples/composite_type/Cargo.toml +++ b/pgx-examples/composite_type/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/custom_sql/Cargo.toml b/pgx-examples/custom_sql/Cargo.toml index 0e45e6c2e..ec5eddc0e 100644 --- a/pgx-examples/custom_sql/Cargo.toml +++ b/pgx-examples/custom_sql/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/custom_types/Cargo.toml b/pgx-examples/custom_types/Cargo.toml index 37a7fe7ff..e0350571b 100644 --- a/pgx-examples/custom_types/Cargo.toml +++ b/pgx-examples/custom_types/Cargo.toml @@ -27,7 +27,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/errors/Cargo.toml b/pgx-examples/errors/Cargo.toml index 8cdda569b..d0618e58c 100644 --- a/pgx-examples/errors/Cargo.toml +++ b/pgx-examples/errors/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/nostd/Cargo.toml b/pgx-examples/nostd/Cargo.toml index ea3d0245b..f3eee1a25 100644 --- a/pgx-examples/nostd/Cargo.toml +++ b/pgx-examples/nostd/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/numeric/Cargo.toml b/pgx-examples/numeric/Cargo.toml index b4793bbd1..f8f62666b 100644 --- a/pgx-examples/numeric/Cargo.toml +++ b/pgx-examples/numeric/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } #[profile.dev] #panic = "unwind" -#lto = "thin" # #[profile.release] #panic = "unwind" diff --git a/pgx-examples/operators/Cargo.toml b/pgx-examples/operators/Cargo.toml index 2df47de9a..99e20c4f4 100644 --- a/pgx-examples/operators/Cargo.toml +++ b/pgx-examples/operators/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/pgtrybuilder/Cargo.toml b/pgx-examples/pgtrybuilder/Cargo.toml index 55539fca6..0b1de43f2 100644 --- a/pgx-examples/pgtrybuilder/Cargo.toml +++ b/pgx-examples/pgtrybuilder/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/schemas/Cargo.toml b/pgx-examples/schemas/Cargo.toml index b1e072cbf..0ef4e87ab 100644 --- a/pgx-examples/schemas/Cargo.toml +++ b/pgx-examples/schemas/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/shmem/Cargo.toml b/pgx-examples/shmem/Cargo.toml index 08ae70671..3f1c2fa6b 100644 --- a/pgx-examples/shmem/Cargo.toml +++ b/pgx-examples/shmem/Cargo.toml @@ -26,7 +26,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/spi/Cargo.toml b/pgx-examples/spi/Cargo.toml index a0cedcd62..53e3730f2 100644 --- a/pgx-examples/spi/Cargo.toml +++ b/pgx-examples/spi/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/spi_srf/Cargo.toml b/pgx-examples/spi_srf/Cargo.toml index 7b5bde6b8..6fe75b5bc 100644 --- a/pgx-examples/spi_srf/Cargo.toml +++ b/pgx-examples/spi_srf/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/srf/Cargo.toml b/pgx-examples/srf/Cargo.toml index 6b7b63e46..e4e94a787 100644 --- a/pgx-examples/srf/Cargo.toml +++ b/pgx-examples/srf/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/strings/Cargo.toml b/pgx-examples/strings/Cargo.toml index 63ad9d6c9..33106a47a 100644 --- a/pgx-examples/strings/Cargo.toml +++ b/pgx-examples/strings/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' # [profile.dev] # panic = "unwind" -# lto = "thin" # [profile.release] # panic = "unwind" diff --git a/pgx-examples/triggers/Cargo.toml b/pgx-examples/triggers/Cargo.toml index 9d6b8e670..2a79b9cb6 100644 --- a/pgx-examples/triggers/Cargo.toml +++ b/pgx-examples/triggers/Cargo.toml @@ -25,7 +25,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' #[profile.dev] #panic = "unwind" -# lto = "thin" #[profile.release] #panic = "unwind" diff --git a/pgx-examples/versioned_so/Cargo.toml b/pgx-examples/versioned_so/Cargo.toml index f1826a8b9..4c3634d3a 100644 --- a/pgx-examples/versioned_so/Cargo.toml +++ b/pgx-examples/versioned_so/Cargo.toml @@ -24,7 +24,6 @@ pgx-tests = { path = "../../pgx-tests" } # uncomment these if compiling outside of 'pgx' #[profile.dev] #panic = "unwind" -# lto = "thin" #[profile.release] #panic = "unwind"