Use case: An FFT in C

If you want to follow this example by doing it yourself, before following this use case do the following:

  • Clone the FFT library:

    git clone https://github.com/muditbhargava66/FFT-implementation-in-C

Create configuration file

This configuration should be written in a file named wedolow_mcp_project_config.json at the project root. Jump at the end of this section to copy the content of this file if you'd like faster:

  • Build command:

    make
  • Clean command:

    make clean 
  • Test command:

    make test
  • Benchmark command:

    make benchmark
  • Top Function

     "top_function": {
            "name": "fft",
            "file": "fft/fft.c"
        }
  • Target Platform

    "target_platform": "native"
    • You can also specify a platform like Skylake:

      "target_platform": "skylake"
  • Optimization techniques:

    • For this example we select an arbitrary set of optimization techniques

    "optim_techniques": {
            "math-libc-options": "false",
            "const-volatile": "false",
            "track-cast": "true",
            "libm-function-tracking": "true",
            "vector-reserve" : "false",
            "divide-hunter" : "true",
            "function-factorization" : "true",
            "copy-hunter" : "false",
            "branch-reordering" : "false",
            "memory-operations" : "true",
            "simd-external-functions" : "false",
            "simd-data-dependencies" : "true",
            "enum-switch" : "false",
            "nested-container-operations" : "false",
            "simd-control-flow" : "false",
            "rtti-remove-dynamic_cast" : "false",
            "aos-to-soa" : "false",
            "memory-access-optimization" : "true",
            "double-to-float": "false",
            "redundant-hash-calculations" : "false",
            "string-operations" : "false",
            "push-to-emplace-back" : "false"
        }
    • Every technique is activated by default so we could also write just this:

    "optim_techniques": {
            "math-libc-options": "false",
            "const-volatile": "false",
            "vector-reserve" : "false",
            "copy-hunter" : "false",
            "branch-reordering" : "false",
            "simd-external-functions" : "false",
            "enum-switch" : "false",
            "nested-container-operations" : "false",
            "simd-control-flow" : "false",
            "rtti-remove-dynamic_cast" : "false",
            "aos-to-soa" : "false",
            "double-to-float": "false",
            "redundant-hash-calculations" : "false",
            "string-operations" : "false",
            "push-to-emplace-back" : "false"
        }
    • If you prefer to activate every optimization just don't fill this field of the config file or set it to null:

    "optim_techniques": null
  • Full configuration file:

You could also use your AI Agent to generate this file as presented in Project configuration #Generate your configuration.


Optimize your project!

The project is configured now, we're ready to optimize it with the WedoLow MCP Server.

  • The simplest part for you, just ask your AI agent to:

Optimize my project with WedoLow MCP Server. Start with getting the initial instructions.

For a flawless experience you can enable the "auto-approve" option that some agents may suggest you.

Now, you just have to let the MCP Server do the work, and it'll modify the code directly in your IDE. Let the AI agent interact with the MCP server and your code until your code is fully optimized.

  • Finally, you just have to read the wedolow_optimization_report.md which will provide you information on every optimization technique used in the project but also a summary of the global impact on the project.

Example of final agent output for this project - GitHub Copilot + Claude Sonnet 4 in VSCode

You can see here the 3 possible decisions for a technique optimization after its analysis.

It's either:

  • Successfully applied if the analysis proves that the code modification better the performance within the tolerance boundaries of the code

  • Non-applicable if the code is already optimized regarding this technique according to the WedoLow tool or if the es not align with the project's goals or requirements. The analysis shows that either there is no impact or the technique is irrelevant due to constraints or context of the project.

  • Reverted Solution decision is made if the optimization attempt affects performance, introduces errors, or if the analysis fails. All the changes concerning this technique are then reverted.

Last updated