kotlin-orm / ktorm

A lightweight ORM framework for Kotlin with strong-typed SQL DSL and sequence APIs.
https://www.ktorm.org
Apache License 2.0
2.13k stars 147 forks source link

ksp 编译速度很慢. KSP compilation speed is very slow. #577

Open JsonSong89 opened 2 months ago

JsonSong89 commented 2 months ago

我按照 https://github.com/kotlin-orm/ktorm/releases/tag/v4.0.0 的配置,换成4.1.1去进行ksp实体代码生成. 8个实体,ksp编译花了 03:44 min ,Entity是独立项目,只有8个实体类的编译,不含其他业务代码和测试代码. 想问下这算是正常情况吗?

I followed the configuration at https://github.com/kotlin-orm/ktorm/releases/tag/v4.0.0 and switched to version 4.1.1 for KSP entity code generation. It took 03:44 min to compile 8 entities using KSP. The Entity is a standalone project with only 8 entity classes, excluding other business code and test code. I would like to ask if this is considered a normal situation?

pom config :

<properties>
    <ktorm.version>4.1.1</ktorm.version>
    <kotlin.version>1.9.23</kotlin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.test.skip>true</maven.test.skip>
</properties>
org.jetbrains.kotlin kotlin-stdlib ${kotlin.version} org.jetbrains.kotlin kotlin-reflect ${kotlin.version} org.ktorm ktorm-core ${ktorm.version} org.ktorm ktorm-support-mysql ${ktorm.version} org.ktorm ktorm-ksp-annotations ${ktorm.version} com.baomidou mybatis-plus-annotation 3.5.7 true
       <sourceDirectory>src/main/kotlin</sourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <compilerPlugins>
                                <compilerPlugin>ksp</compilerPlugin>
                            </compilerPlugins>
                            <pluginOptions>
                                <option>ksp:apoption=ktorm.dbNamingStrategy=lower-snake-case</option>
                            </pluginOptions>
                        </configuration>
                    </execution>
                    <!--                    <execution>-->
                    <!--                        <id>test-compile</id>-->
                    <!--                        <phase>test-compile</phase>-->
                    <!--                        <goals>-->
                    <!--                            <goal>test-compile</goal>-->
                    <!--                        </goals>-->
                    <!--                        <configuration>-->
                    <!--                            <compilerPlugins>-->
                    <!--                                <compilerPlugin>ksp</compilerPlugin>-->
                    <!--                            </compilerPlugins>-->
                    <!--                            <pluginOptions>-->
                    <!--                                <option>ksp:apoption=ktorm.dbNamingStrategy=lower-snake-case</option>-->
                    <!--                            </pluginOptions>-->
                    <!--                        </configuration>-->
                    <!--                    </execution>-->
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.ktorm</groupId>
                        <artifactId>ktorm-ksp-compiler-maven-plugin</artifactId>
                        <version>${ktorm.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
vincentlauvlwj commented 2 months ago

可以提供下你的项目代码和机器配置

JsonSong89 commented 2 months ago

31.entity.zip

原来是7个实体,我删到只剩2个,现在用时70s 35 * 7 , 和原来的速度也差不多对的上

JsonSong89 commented 2 months ago

机器配置是5600x 32g内存 固态硬盘 jdk21.0.4 win10系统