How to Avoid Slow Processor Expert Projects

The Eclipse IDE is in my view the best IDE in the world :-). But it is not the fastest one: All the functionality and comfort has a price, and such a Java and highly flexible IDE requires its resources. The Eclipse community is continuously addressing that concern, and for example the Eclipse Juno 4.2 IDE in CodeWarrior for MCU10.5 shows this nicely: things are much smoother compared to the Eclipse Indigo 3.7 in MCU10.4. But if you feel that you do not want to use Processor Expert because it is too slow, then I have a trick how to improve performance by a factor of 10 :-).

I’m still investigating what is causing this, but I have found an easy way how to improve build (compile and link) performance. It is about when Processor Expert generates the source code. If you are not familiar with Processor Expert code generation, I explain briefly the concept first:

Processor Expert Code Generation

Processor Expert is a very powerful Eclipse plugin which allows me to configure my device drivers and software components in a graphical way. Using components, I can port and build complex applications to different platforms very fast (typically in much less than one hour). Processor Expert uses the concept of generating driver code out of a meta-language: I write my drivers and software once, and can use it immediately on different platforms and hardware, can easily share and re-use it. It is all about reusing and configuring software for different needs.

Processor Expert maintains all the settings in a big XML file inside the project: the ProcessorExpert.pe file:

ProcessorExpert.pe File inside Project

ProcessorExpert.pe File inside Project

No need to edit that XML file: the ‘Components’ view provides the entry point for different editors to it to change the settings. And it has a button to ‘Generate Code’:

Components View with Generate Code Button

Components View with Generate Code Button

If I press ‘Generate Code’, then it processes all the information in the XML file, and based on the settings it generates the source code for all the drivers.

Development Flow: Building Projects

My typical developement flow is

  1. Change Processor Expert settings
  2. Press ‘Generate Code’
  3. Perform a Build on the project (compile, link)
  4. Debug it
  5. Change my source files, and go back to step 3

I do much more changes in my source code than changes in the Processor Expert settings, so above step 1 and 2 is not needed all time.

But using MCU10.5 I noticed that somehow the time for doing step 3 (building my project) seems to take longer than before?

Build Progress

Looking at the build progress, I noticed that things are stuck for a while. Checking the Console view showed me that it started the build, but was not doing anything for rather a long time:

Build Console View

Build Console View

So it started the build, but is stuck? So I decided to look at the Progress view and to cancel the build:

Cancel Build Operation

Cancel Build Operation

And then (surprise, surprise), I had this:

Processor Expert Code Generation Failed

Processor Expert Code Generation Failed

It is a surprise to me as I just did a ‘build’, and not a ‘Generate Code’ action. And I have not changed any Processor Expert settings at all! So why is it generating Processor Expert code?

Disabling Processor Expert Code Generation

That reminded me about an earlier article I wrote about improving debugger launch time ;-). There is a *project* setting about this:

Processor Expert Generate code before build automatically

Processor Expert Generate code before build automatically

๐Ÿ’ก The above setting is project specific. You get to the project settings with selecting the project root folder and then use the menu Project > Settings. Or use the context menu on the project folder.

So I decided to set this option to ‘no‘. And things improved a lot :-).

Build Time Benchmarks

And the time to do a build reduced dramatically. To show the impact, I did a build on larger project. No files/settings have been changed, just to see how long it needs ‘to do nothing’:

In my experiments, I open a small project with ‘Project > Open’ and then do a ‘Build’ on it:

  • With ‘Generate code before build automatically’ set to yes: 58 seconds ๐Ÿ˜ฆ
  • With ‘Generate code before build automatically’ set to no: 5 seconds ๐Ÿ™‚

I noticed that it generates new code when I open the project. And this was just for a small project with a few components. And there is no reason for generating code as I have not changed anything! So I did the same thing without opening the project (just doing a build):

  • With ‘Generate code before build automatically’ set to yes: 8 seconds ๐Ÿ˜ฆ
  • With ‘Generate code before build automatically’ set to no: 5 seconds ๐Ÿ™‚

There is still some overhead, but not the same as if I just would have opened the project. The same effect happens if I switch or open a workspace. In any case, disabling ‘Generate code before build automatically’ helps a lot.

Opening the project has some undesired consequences for Processor Expert. The issue is that I have many projects in my workspace, and I do frequent close/re-open of projects: having just the needed set of projects in general improves Eclipse performance. But in the case of Processor Expert it is doing more harm than good :-(.

Summary

Modern IDE’s are great, and it is a great thing if tools try to cover for bad human behaviour. It is probably a good thing that Processor Expert tries to generate code if there is a change. But unfortunately this slows down a build a lot (at least for me using Processor Expert intensively). The good news is that there is an option in the project settings to speed up things with disabling automatic code generation: I can and want to be in charge when I generate code. Like I want to be in charge to rebuild my application before doing debug. It is a nice feature that the system automatically generates code and/or builds the application before I do a debug, but this costs time and adds comfort I do not need (I hope I know that I’m doing ๐Ÿ˜‰ ).

I think that comfort would be great if it would not have such a performance impact.

  1. ‘Generate code before build automatically’ should not be noticeable if I have not changed any Processor Expert settings.
  2. Opening a project either with Project > Open or opening a workspace somehow let Processor Expert think it needs to generate code. This has a very bad impact on building that project, as it causes a long build process.
  3. The option ‘Generate code before build automatically’ should be a workspace option. I do not want to set that option for every single project.

Until then, I have at least a workaround :mrgreen:. And I highly recommend everyone using Processor Expert to disable that option in the project.

Happy Experting ๐Ÿ™‚

3 thoughts on “How to Avoid Slow Processor Expert Projects

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.