Community
Participate
Working Groups
I marked the following services as singleton on two different machines and got an 2% to 15% performance win depending on the numbers that I compared (best vs worst, worst vs worst, worst vs best, 2x5 runs with current state and with @singleton present) Specifically these services are: common.types.util .Primitives .RawTypeHelper .SuperTypeCollector .TypeArgumentContextProvider .TypeConformanceComputer .TypeReferences .VisibilityService xbase.scoping.featurecalls .DefaultFeaturesForTypeProvider .JvmFeatureSignatureProvider .XConstructorProvider xbase.typing .SynonymTypesProvider xtext.resource .FileExtensionProvider Please review that list to make sure that I did not miss any state in those services and that the measured performance improvements are really there and were no accidentally experienced numbers. The motivation for this 'experiment' was a CPU snapshot which rendered itself useless since almost all time was summarized under XbaseScopeProvider#newDefaultFeatureDescriptionProvider and #newSugarDescriptionProvider
When marking a service as singleton all transitive reps become defacto singletons. I wonder whether we want to explicitly mark everything as singleton or just the important top level components. As most of our injected services are stateless, marking all of them @Singleton sound like a good idea. I'm just a bit afraid of those cases where we accidentally introduced state... Those bugs are hard to find.
+1 for marking all the stateless services as singleton We could write a unit test which inspects the injector for all singleton bindings and validates that no service is used which is not a singleton and that no field is declared which looks like state. Should be straight forward to implement with the binding SPI and / or the common types.
Pushed some singleton-annotations to master
Just out of curiosity: What was the actual test case for the benchmarks?
I used the total execution time of org.eclipse.xtext.xtend2.ui.tests.performance.PerformanceTest and the number that is printed in assertFasterThen(..) as a simple heuristic.
Closing this as the important types have been marked with @Singleton
Closing all bugs that were set to RESOLVED before Neon.0