From b53f8a63c944f4a62c9af285db6a13f31cfe61bb 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/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 - 20 files changed, 20 deletions(-) diff --git a/cargo-pgx/src/templates/cargo_toml b/cargo-pgx/src/templates/cargo_toml index 18dc0459b9..bc03792c53 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 44011f8268..950c89d75c 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 07c66da9c0..896abfa370 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 7e6bf392a5..5c31dcfb2c 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 35ff701719..1ea925be20 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 80bce3d701..57e20675c0 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 0e45e6c2e4..ec5eddc0e9 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 37a7fe7ff3..e0350571b5 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 8cdda569b2..d0618e58c6 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 ea3d0245b2..f3eee1a252 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/operators/Cargo.toml b/pgx-examples/operators/Cargo.toml index 2df47de9a0..99e20c4f42 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 55539fca68..0b1de43f25 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 b1e072cbf1..0ef4e87ab0 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 08ae706714..3f1c2fa6b7 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 a0cedcd628..53e3730f24 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 7b5bde6b81..6fe75b5bcf 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 6b7b63e469..e4e94a7877 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 63ad9d6c91..33106a47aa 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 9d6b8e670a..2a79b9cb66 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 f1826a8b9e..4c3634d3ae 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"