Code Monkey home page Code Monkey logo

Comments (13)

nakamura-to avatar nakamura-to commented on June 3, 2024 1

#1034 の修正でこの問題はほとんど解消されると思います。
リリースされたらお試しください。
もし問題が解決されないようであればこのissueを再度オープンにしたいと思います。

from doma.

inoue-koki avatar inoue-koki commented on June 3, 2024 1

対応ありがとうございます!こちらでも確認しました。

きちんと計測していませんが、Java8の時と比較するとまだ少し遅く感じるものの、対応前と比較すると明らかにビルド時間が短くなっていることが確認できました。

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

最近Eclipseを使っていないので見当違いなことを言っていたらすみません。

Eclipseから「Project > Clean... > Start a build immediately」を行う。

この時はEclipse内のコンパイラを使ってビルドが行われGradleは使われない認識です。少なくともEclpse 2020-03くらいまではそのような挙動でした。しかし、Eclipse 2023-09ではEclpseからGradleが呼ばれビルドされるということでしょうか?

このため、Eclipseの問題である気はしています。

私もそんな気がします。
Eclipseに十分なメモリを割り当てたら問題は改善されないでしょうか?

from doma.

inoue-koki avatar inoue-koki commented on June 3, 2024

回答ありがとうございます!

この時はEclipse内のコンパイラを使ってビルドが行われGradleは使われない認識です。少なくともEclpse 2020-03くらいまではそのような挙動でした。しかし、Eclipse 2023-09ではEclpseからGradleが呼ばれビルドされるということでしょうか?

いえ、最近のEclipseでもビルドの仕組みは変わっていないと思います。
「Project > Clean... > Start a build immediately」の手順は、単純に「クリーンビルドをしている=一番時間がかかる時」を言いたかったまでです。

Eclipseに十分なメモリを割り当てたら問題は改善されないでしょうか?

現在は、-Xmx4gを指定しています。
8GBまで増やしてみたんですが、状況変わらずでした。

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

いえ、最近のEclipseでもビルドの仕組みは変わっていないと思います。
「Project > Clean... > Start a build immediately」の手順は、単純に「クリーンビルドをしている=一番時間がかかる時」を言いたかったまでです。

なるほど。だとすると、再現手順に記載いただいた「build.gradle の sourceCompatibility targetCompatibility を変更する。」との関係はどうなりますか?「Project > Clean... > Start a build immediately」は、build.gradleの設定を見て動作しているのかしていないかどちらですか?

現象が再現する環境を共有してもらうことは可能でしょうか?Eclipseの設定ファイルが含まれた状態でいただきたいです。

from doma.

inoue-koki avatar inoue-koki commented on June 3, 2024

なるほど。だとすると、再現手順に記載いただいた「build.gradle の sourceCompatibility targetCompatibility を変更する。」との関係はどうなりますか?「Project > Clean... > Start a build immediately」は、build.gradleの設定を見て動作しているのかしていないかどちらですか?

分かりづらくて申し訳ないです。

  1. build.gradleを変更し、
  2. 「Gradle > Refresh Gradle Project」でBuildshipを動かし、変更内容をEclipseの設定ファイルに反映し、
  3. Eclipseからクリーンビルドを行う。

という手順ですので、build.gradleの設定は間接的に見ている認識です。

現象が再現する環境を共有してもらうことは可能でしょうか?Eclipseの設定ファイルが含まれた状態でいただきたいです。

計測に使ったDAOが外に出せないものを使っているので、すぐには共有できないですが少し検討させてください。

いったん、Eclipseの設定ファイルだけ貼らせてください。(ほぼデフォルト設定のはずです)
また、build.gradleも貼らせていただきます。余計な依存関係が一部含まれてしまっていますが、ご容赦ください。

  • .classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="bin/main" path="src/main/java">
		<attributes>
			<attribute name="gradle_scope" value="main"/>
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/main" path="src/main/resources">
		<attributes>
			<attribute name="gradle_scope" value="main"/>
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/test" path="src/test/java">
		<attributes>
			<attribute name="gradle_scope" value="test"/>
			<attribute name="gradle_used_by_scope" value="test"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/main" path=".apt_generated"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
	<classpathentry kind="src" output="bin/test" path=".apt_generated_tests">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="bin/default"/>
</classpath>
  • .factorypath
<factorypath>
  <factorypathentry kind='EXTJAR' id='/Users/kinoue/.gradle/caches/modules-2/files-2.1/org.seasar.doma/doma-processor/2.54.2/b95d49ba0cc1d0806d859adaed5cff2bd174cfd/doma-processor-2.54.2.jar' enabled='true' runInBatchMode='false' />
  <factorypathentry kind='EXTJAR' id='/Users/kinoue/.gradle/caches/modules-2/files-2.1/org.seasar.doma/doma-core/2.54.2/b9e06221ca2d0786cc4a08ee858b8250b4a5ad29/doma-core-2.54.2.jar' enabled='true' runInBatchMode='false' />
</factorypath>
  • .project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>all-tables</name>
	<comment>Project all-tables created by Buildship.</comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
	</natures>
</projectDescription>
  • .settings/org.eclipse.buildship.core.prefs
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=false
show.executions.view=false
  • .settings/org.eclipse.jdt.apt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
org.eclipse.jdt.apt.reconcileEnabled=true
  • .settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
  • .settings/org.springframework.ide.eclipse.prefs
boot.validation.initialized=true
eclipse.preferences.version=1
  • build.gradle
def jdkVersion = 11
def domaVersion = '2.54.2'
def lombokVersion = '1.18.30'
def springBootVersion = '2.7.18'

repositories {
    mavenCentral()
}

apply plugin: 'java'

sourceCompatibility = targetCompatibility = jdkVersion

dependencies {
    implementation "org.seasar.doma:doma-core:${domaVersion}"
    annotationProcessor "org.seasar.doma:doma-processor:${domaVersion}"
    runtimeOnly 'com.mysql:mysql-connector-j:8.2.0'

    compileOnly "org.projectlombok:lombok:${lombokVersion}"
    annotationProcessor "org.projectlombok:lombok:${lombokVersion}"

    implementation 'com.google.code.gson:gson:2.10.1'

    implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
    implementation "org.springframework.boot:spring-boot-starter-validation:${springBootVersion}"
}


apply plugin: 'eclipse'
eclipse {
    classpath {
        file.whenMerged {
            entries << new org.gradle.plugins.ide.eclipse.model.SourceFolder(".apt_generated", "bin/main")
        }
    }
}
eclipseJdt {
    task doLast {
        file('.factorypath').withWriter { writer ->
            def domaCoreJar = configurations.annotationProcessor.copy().find { it.name.startsWith('doma-core-2') }
            def domaProcessorJar = configurations.annotationProcessor.copy().find { it.name.startsWith('doma-processor-2') }

            new groovy.xml.MarkupBuilder(writer).factorypath() {
                factorypathentry(kind:'EXTJAR', id:domaProcessorJar, enabled:true, runInBatchMode:false)
                factorypathentry(kind:'EXTJAR', id:domaCoreJar, enabled:true, runInBatchMode:false)
            }
        }
    }
}


def domaResources = ['doma.compile.config', 'META-INF/**/*.sql', 'META-INF/**/*.script']
task copyDomaResources(type: Copy) {
    from sourceSets.main.resources.srcDirs
    into compileJava.destinationDir
    include domaResources
}
compileJava.dependsOn copyDomaResources
processResources.exclude domaResources

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

共有ありがとうございます。再現ができました。

また、本現象の回避方法も見つけました。
Enable processing in editorのオプションをOFFにしてみてください。

Disable processing in editor

私の環境ではこれでパフォーマンスが向上しました。

from doma.

inoue-koki avatar inoue-koki commented on June 3, 2024

ご確認ありがとうございます。
私の環境でも設定を変えて計測してみたところ、Java8での性能には及ばないものの改善が見られました。

Java8 + オプションON = 約10秒
Java11 + オプションON = 約440秒
Java11 + オプションOFF = 約240秒

無茶を承知でお聞きするのですが、他に改善策に心当たりはありませんでしょうか?
Java8時と比較すると改善後でもそれなりの時間がかかっているため、出来ることがあればやりたいと考えています。

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

改善策と言えるかはわかりませんが、Eclipseの開発者に尋ねてみるのが良いと思います。

質問なのですが、パフォーマンスの問題はDomaのAnnotation Processorだけで顕在化していますか?Lombokをお使いのようですがLombokのAnnotation Processorでは問題になりませんか?

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

ワークアラウンドとしては、Domaの注釈処理が必要なEntityやDaoを別プロジェクトに切り出してそのプロジェクトはJava 8でビルドし、その他のプロジェクトはJava 11でビルドするなどとしても良いかもしれません。

from doma.

inoue-koki avatar inoue-koki commented on June 3, 2024

やはりこれ以上は本家に聞いてみるしかないですよね。。
少しハードルが高めなので、教えていただいた緩和策で様子を見つつ、どうしても待てないなら考えてみたいと思います。
提示いただいたワークアラウンドも、ソース量を考えると少し難しいですが、選択肢として頭に入れておきます。

質問なのですが、パフォーマンスの問題はDomaのAnnotation Processorだけで顕在化していますか?Lombokをお使いのようですがLombokのAnnotation Processorでは問題になりませんか?

試していなかったので、lombokのアノテーションを消し依存もなくしてEclipseからクリーンビルドを行ってみました。
結果、ビルド時間は変わらなかったので、lombokでは問題になっていないと言えそうです。

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

lombokでは問題になっていないのですね。ご回答ありがとうございます。

from doma.

nakamura-to avatar nakamura-to commented on June 3, 2024

v2.55.0としてリリース済みです。
https://github.com/domaframework/doma/releases/tag/2.55.0

from doma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.