Skip to content

Commit 397d11c

Browse files
committed
apply code review
1 parent b19742f commit 397d11c

6 files changed

Lines changed: 17 additions & 22 deletions

File tree

docs/src/modules/ROOT/pages/constraints-and-score/performance.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ which is called in its deepest loops.
99
Faster score calculation will return the same solution in less time with the same algorithm,
1010
which normally means a better solution in equal time.
1111

12-
1312
[#moveEvaluationSpeed]
1413
== Move evaluation and score calculation speed
1514

@@ -62,6 +61,11 @@ without forcing you to write a complicated incremental score calculation algorit
6261
Note that the speedup is relative to the size of your planning problem (your __n__),
6362
making incremental score calculation far more scalable.
6463

64+
[#enterprisePerformanceImprovements]
65+
== Enterprise performance improvements
66+
67+
The xref:commercial-editions/commercial-editions.adoc[Enterprise Edition] of Timefold Solver has a number of xref:commercial-editions/performance-improvements.adoc[performance improvements] that can further speed up score calculation.
68+
The Enterprise Edition also allows for <<constraintProfiling,Constraint Profiling>>, making it easy to identify constraint performance bottlenecks.
6569

6670
[#avoidCallingRemoteServicesDuringScoreCalculation]
6771
== Avoid calling remote services during score calculation
@@ -305,10 +309,6 @@ The code on the hot path of your application needs to be as fast as possible.
305309
* The second best option is to use a `HashMap` or `HashSet`.
306310
* Avoid using `java.util.Stream` or any other form of explicit iteration in constraints, as that is much slower.
307311

308-
[#enableAutomaticNodeSharing]
309-
== Enable automatic node sharing
310-
If you are using the xref:commercial-editions/commercial-editions.adoc[Enterprise Edition], you should xref:commercial-editions/performance-improvements.adoc#automaticNodeSharing[enable automatic node sharing] as it can significantly speed up score calculation.
311-
312312
[#benchmark]
313313
== Benchmark
314314
Whatever you do, benchmark on a large and diverse set of inputs.

quarkus-integration/quarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/config/SolverBuildTimeConfig.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface SolverBuildTimeConfig {
3131
* Enable the Nearby Selection quick configuration.
3232
* <p>
3333
* Note: this setting is only available in Timefold Solver
34-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
34+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
3535
*/
3636
// Build time - visited by SolverConfig.visitReferencedClasses
3737
// which generates the constructor used by Quarkus
@@ -48,7 +48,7 @@ public interface SolverBuildTimeConfig {
4848
* If constraint profiling is enabled. Defaults to false.
4949
* <p>
5050
* Note: this setting is only available in Timefold Solver
51-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
51+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
5252
*/
5353
Optional<Boolean> constraintStreamProfilingEnabled();
5454

@@ -57,10 +57,11 @@ public interface SolverBuildTimeConfig {
5757
* so nodes share lambdas when possible, improving performance.
5858
* When enabled, breakpoints placed in the {@link ConstraintProvider}
5959
* will no longer be triggered.
60-
* Defaults to "true".
60+
* Defaults to "true"; the solver may decide to disable it regardless,
61+
* if it turns out the feature can not be supported in a given environment.
6162
* <p>
6263
* Note: this setting is only available in Timefold Solver
63-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
64+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
6465
*/
6566
// Build time - modifies the ConstraintProvider class if set
6667
Optional<Boolean> constraintStreamAutomaticNodeSharing();

quarkus-integration/quarkus/deployment/src/test/java/ai/timefold/solver/quarkus/TimefoldProcessorNodeSharingFailFastTest.java renamed to quarkus-integration/quarkus/deployment/src/test/java/ai/timefold/solver/quarkus/TimefoldProcessorNodeSharingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import io.quarkus.test.QuarkusUnitTest;
1818

19-
public class TimefoldProcessorNodeSharingFailFastTest {
19+
public class TimefoldProcessorNodeSharingTest {
2020

2121
@RegisterExtension
2222
static final QuarkusUnitTest config = new QuarkusUnitTest()

quarkus-integration/quarkus/runtime/src/main/java/ai/timefold/solver/quarkus/config/SolverRuntimeConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface SolverRuntimeConfig {
3030

3131
/**
3232
* Note: this setting is only available in Timefold Solver
33-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
33+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
3434
* Enable multithreaded solving for a single problem, which increases CPU consumption.
3535
* Defaults to {@value SolverConfig#MOVE_THREAD_COUNT_NONE}.
3636
* Other options include {@value SolverConfig#MOVE_THREAD_COUNT_AUTO}, a number

spring-integration/spring-boot-autoconfigure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/config/SolverProperties.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class SolverProperties {
3333

3434
/**
3535
* Note: this setting is only available in Timefold Solver
36-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
36+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
3737
* Enable multithreaded solving for a single problem, which increases CPU consumption.
3838
* Defaults to "NONE".
3939
* Other options include "AUTO", a number or formula based on the available processor count.
@@ -51,12 +51,13 @@ public class SolverProperties {
5151

5252
/**
5353
* Note: this setting is only available in Timefold Solver
54-
* <a href="https://timefold.ai/docs/timefold-solver/latest/enterprise-edition/enterprise-edition">Enterprise Edition</a>.
54+
* <a href="https://timefold.ai/docs/timefold-solver/latest/commercial-editions/commercial-editions">Enterprise Edition</a>.
5555
* Enable rewriting the {@link ConstraintProvider} class
5656
* so nodes share lambdas when possible, improving performance.
5757
* When enabled, breakpoints placed in the {@link ConstraintProvider}
5858
* will no longer be triggered.
59-
* Defaults to "true".
59+
* Defaults to "true"; the solver may decide to disable it regardless,
60+
* if it turns out the feature can not be supported in a given environment.
6061
*/
6162
private Boolean constraintStreamAutomaticNodeSharing;
6263

spring-integration/spring-boot-autoconfigure/src/test/java/ai/timefold/solver/spring/boot/autoconfigure/TimefoldSolverConstraintAutoConfigurationTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class TimefoldSolverConstraintAutoConfigurationTest {
3636

3737
private final ApplicationContextRunner contextRunner;
3838
private final ApplicationContextRunner multiConstraintProviderRunner;
39-
private final ApplicationContextRunner fakeNativeWithNodeSharingContextRunner;
4039
private final ApplicationContextRunner fakeNativeWithoutNodeSharingContextRunner;
4140
private final FilteredClassLoader testFilteredClassLoader;
4241

@@ -49,17 +48,11 @@ public TimefoldSolverConstraintAutoConfigurationTest() {
4948
.withConfiguration(
5049
AutoConfigurations.of(TimefoldSolverAutoConfiguration.class, TimefoldSolverBeanFactory.class))
5150
.withUserConfiguration(MultipleConstraintSpringTestConfiguration.class);
52-
fakeNativeWithNodeSharingContextRunner = new ApplicationContextRunner()
53-
.withConfiguration(
54-
AutoConfigurations.of(TimefoldSolverAutoConfiguration.class, TimefoldSolverBeanFactory.class))
55-
.withUserConfiguration(NormalSpringTestConfiguration.class)
56-
.withPropertyValues("timefold.solver.%s=ON"
57-
.formatted(SolverProperty.CONSTRAINT_STREAM_AUTOMATIC_NODE_SHARING.getPropertyName()));
5851
fakeNativeWithoutNodeSharingContextRunner = new ApplicationContextRunner()
5952
.withConfiguration(
6053
AutoConfigurations.of(TimefoldSolverAutoConfiguration.class, TimefoldSolverBeanFactory.class))
6154
.withUserConfiguration(NormalSpringTestConfiguration.class)
62-
.withPropertyValues("timefold.solver.%s=OFF"
55+
.withPropertyValues("timefold.solver.%s=false"
6356
.formatted(SolverProperty.CONSTRAINT_STREAM_AUTOMATIC_NODE_SHARING.getPropertyName()));
6457
testFilteredClassLoader =
6558
new FilteredClassLoader(new ClassPathResource(TimefoldProperties.DEFAULT_SOLVER_CONFIG_URL));

0 commit comments

Comments
 (0)