FluentMySQLConfiguration's memberwise initializer takes a minute to typecheck
vzsg opened this issue · 1 comments
Describe the bug
This initializer, when used with nil coalescing all around the place like in the template, is causing the Swift compiler to typecheck for about an extra minute on M1 (146 seconds in total with dependencies already resolved).
In particular, this line seems to cause the issue in the template:
Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? MySQLConfiguration.ianaPortNumber
But I'm opening the issue here, because the same expression is used in the template project for Postgres, and that configuration builds "immediately" (71 seconds in total with dependencies already resolved).
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/vapor/template-fluent-mysql
cd template-fluent-mysql
swift build
- Observe that the compilation hangs at the last batch of files in the App module.
Expected behavior
The template project should build as fast as it does with the Postgres driver.
Environment
Dependencies:
├── vapor<https://github.com/vapor/vapor.git@4.78.2>
└── fluent-mysql-driver<https://github.com/vapor/fluent-mysql-driver.git@4.4.0>
└── mysql-kit<https://github.com/vapor/mysql-kit.git@4.7.1>
└── mysql-nio<https://github.com/vapor/mysql-nio.git@1.7.0>
System:
- macOS 13.5 (22G74)
- Xcode 14.3.1 (14E300c)
Wow. With Postgres I solved that by adding an explicit type... Had no idea MySQL was similarly affected. I'll see what I can do.