pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
183 stars 53 forks source link

Reduce the resource usage of go when compiling `compute` #1384

Open iwahbe opened 11 months ago

iwahbe commented 11 months ago

Hello!

Issue details

This is a continuation from https://github.com/pulumi/pulumi-gcp/issues/1283.

Closing #1283 reduced the memory usage by half, but compiling an IaC program should use less than 4GB. We should continue to explore strategies to reduce resource usage while compiling compute.

Suggested strategies

Affected area/feature

t0yv0 commented 11 months ago

We can also remove some supplementary types like being less aggressive with the monomorphic forms (PtrOutput etc).

This bloat is generally not confined to GCP. I wrote a quick script to detect bloat across all our providers.

#!/usr/bin/env bash

set -euo pipefail

providers=$(curl https://raw.githubusercontent.com/pulumi/ci-mgmt/master/provider-ci/providers.json | jq -r .[])

echo "| P | rel | br | pf | pkg | sdk |"
for p in $providers
do
    D="/tmp/pulumi-$p"
    find "$D/sdk/go" -name pulumiTypes1.go
done

find "/Users/t0yv0/code/pulumi-azure-native-sdk" -name pulumiTypes1.go
find "/Users/t0yv0/code/pulumi-aws-native" -name pulumiTypes1.go
find "/Users/t0yv0/code/pulumi-kubernetes" -name pulumiTypes1.go
/tmp/pulumi-akamai/sdk/go/akamai/pulumiTypes1.go
/tmp/pulumi-aws/sdk/go/aws/wafv2/pulumiTypes1.go
/tmp/pulumi-azure/sdk/go/azure/appservice/pulumiTypes1.go
/tmp/pulumi-datadog/sdk/go/datadog/pulumiTypes1.go
/tmp/pulumi-gcp/sdk/go/gcp/compute/pulumiTypes1.go
/tmp/pulumi-oci/sdk/go/oci/database/pulumiTypes1.go
/tmp/pulumi-oci/sdk/go/oci/core/pulumiTypes1.go
/tmp/pulumi-oci/sdk/go/oci/identity/pulumiTypes1.go
/tmp/pulumi-rancher2/sdk/go/rancher2/pulumiTypes1.go
/tmp/pulumi-sumologic/sdk/go/sumologic/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/datafactory/v20180601/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/datafactory/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/network/v20230501/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/network/v20230201/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/network/v20230601/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/network/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/network/v20230401/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/machinelearningservices/v20230801preview/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/machinelearningservices/v20230401preview/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/machinelearningservices/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/machinelearningservices/v20231001/pulumiTypes1.go
/Users/t0yv0/code/pulumi-azure-native-sdk/machinelearningservices/v20230601preview/pulumiTypes1.go
/Users/t0yv0/code/pulumi-aws-native/sdk/go/aws/quicksight/pulumiTypes1.go