Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to speed up Configuration #509

Open
wants to merge 123 commits into
base: main
Choose a base branch
from

Conversation

cedar-cranson
Copy link

Our object model has way too many model classes which I recognize is a problem but would like for it to start up as fast as possible. Here are three small changes that speed up our configuration a lot.

First is putting creation of MappingXmlFile into a parallel stream for my computer and our large object model. This reduced start up by about 7 seconds (this change also has the benefit on my computer of making the time to run all of the Fluent Tests from 17 seconds to 10 seconds).

The second change is putting the creation of the mapping classes into a parallel stream for my computer and our large object model. This reduced start up by about 10 seconds.

The third change is to extract property.Name into a var so it does not have to be executed every time inside of the Any loop. This reduced our startup by about 8 seconds.

Please let me know if you have any questions or would like more information. Thanks

.Where(x => IsMappingOf<IMappingProvider>(x) ||
IsMappingOf<IIndeterminateSubclassMappingProvider>(x) ||
IsMappingOf<IExternalComponentMappingProvider>(x) ||
IsMappingOf<IFilterDefinition>(x))
.Each(Add);
.AsParallel().AsOrdered().Select(t => t.InstantiateUsingParameterlessConstructor()).ToList())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a possible breaking change for applications needing to spare as much as possible the threads count they are using. Of course normally configuration happens at startup, at a time where sparing threads usually matters less. But that may not be always the case.

So, I think we need a way to choose not to use any parallelism for building the mappings. And enabling parallel build should rather be opt-in, to avoid being a possible breaking change needing a code or config change to be reverted for existing applications.

@cedar-cranson
Copy link
Author

Pushed up a change so number of threads can be set when configure is called.

I did not mean to click the merge button and am sorry if that causes any issues. Hopefully nothing happened because I do not have write access but very sorry if it did cause any work.

Thanks

JAelwynTyler and others added 21 commits August 31, 2022 15:22
Create a suite of {I,}HbmConverter* classes and interfaces structured as a
parallel hierarchy to the {I,}XmlWriter* classes and interfaces in order to
support direct-to-HBM configuration conversion.
* Modify the base conversion interfaces to require fluent types to implement
  IMapping
* Use a more intuitive type abbreviation for fluent types
JAelwynTyler and others added 30 commits September 7, 2022 16:11
Note that this commit covers both IComponentMapping→* and
ReferenceComponentMapping→* converters.
Cache typestrings to avoid significant duplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants