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

v2.3.3 is significantly slower than v2.3.0 #123

Open
bwmodular opened this issue Dec 15, 2023 · 4 comments
Open

v2.3.3 is significantly slower than v2.3.0 #123

bwmodular opened this issue Dec 15, 2023 · 4 comments

Comments

@bwmodular
Copy link

I recently upgraded a project from FXE 2.3.0 to 2.3.3

Previous runs of 455 tests which were consistently coming in at 2.8 mins, now consistently coming in at 4.7 minutes.

I've downgraded and upgraded a few times to retest and the time difference is consistent every time.

It's not a major problem, but wondered if you or any other users had noticed anything similar yourself or had any tips on what might be slowing things down? Happy to do more investigative work to try and establish if there are any particular tests which are slower, or if its all of them...

@jordimontana82
Copy link
Contributor

jordimontana82 commented Dec 15, 2023

@bwmodular Thanks Ben! Would be good to know the exact middleware configuration as well as a few hints:

  • .NET framework version
  • Do you use pipeline simulation
  • How many plugins?
  • Autoregistration?
  • Metadata?
  • Many records per test?

Etc

And we maybe we could add more benchmarks to compare 2.3.0 vs 2.3.3

@bwmodular
Copy link
Author

Hi Jordi,
thanks for the reply.

  • .NET framework version - 4.6.2
  • Do you use pipeline simulation Yes, in a minority of tests. I suspect that this is where the slowness comes from but haven't proved it yet.
  • How many plugins? 84 Plugin step registrations
  • Autoregistration? Yes
  • Metadata? No
  • Many records per test? No, except in one particular plugin

If I have time next week I'll see if I can pin down the particularly slow tests in 2.30 and see how they perform in 2.3.3.

@bwmodular
Copy link
Author

I'm using 2 diffrerent middleware cofigs, one for testing with pipeline simulation and one without.
Here's without:
_public FakeXrmEasyTestsBaseWithoutPipelineSimulation()
{
_context = MiddlewareBuilder
.New()
.AddCrud()
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(Account)))
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(AddListMembersListRequestExecutor)))
.UseCrud()
.UseMessages()
.SetLicense(FakeXrmEasyLicense.Commercial)
.Build();
_service = _context.GetOrganizationService();
_tracing = context.GetTracingService();
}

and here's with:
_public FakeXrmEasyTestsBaseWithPipelineSimulation()
{
_context = MiddlewareBuilder
.New()
.AddCrud()
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(Account)))
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(AddListMembersListRequestExecutor)))
.AddPipelineSimulation(new PipelineOptions()
{
UsePluginStepAudit = true,
UseAutomaticPluginStepRegistration = true,
PluginAssemblies = new List()
{
Assembly.GetAssembly(typeof(Opportunity_PostOperationCreatePlugin))
},
CustomPluginStepDiscoveryFunction = PluginStepDiscoveryFn
})
// Use* -> Defines pipeline sequence
.UsePipelineSimulation()
.UseCrud()
.UseMessages()
.SetLicense(FakeXrmEasyLicense.Commercial)
.Build();
_service = _context.GetOrganizationService();
_tracing = context.GetTracingService();
}

private Func<Assembly, IEnumerable> PluginStepDiscoveryFn = (Assembly assembly) =>
{
return (from t in assembly.GetTypes()
let attributes = t.GetCustomAttributes(typeof(CrmPluginRegistrationAttribute), true)
where attributes != null && attributes.Length > 0
select attributes
.Cast()
.Where(pluginAttribute => pluginAttribute.Stage != null) //Exclude custom apis
.Select(attribute => attribute.ToPluginStepDefinition(t))
).SelectMany(pluginStep => pluginStep)
.AsEnumerable();
};

I'll do some more tests to try and work out what it is that's being particularly slow...

@jordimontana82
Copy link
Contributor

@bwmodular I'll take a look at performance again after the release of 2.5.x versions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants