# Development Principles

## High Performance

[HFSM2](https://github.com/andrew-gresyk/HFSM2) uses template meta-programming to generate **optimal code** for a given FSM topology.

It does not use performance-prohibitive dynamic allocation, virtual methods, complex algorithms.

The structural information is **statically encoded** into the FSM instance **type**, which removes the need for complex lookups, and internal bookkeeping logic can always **access** the required information **directly**.

## Small Footprint

With memory access being the performance bottleneck on modern architectures, small data structures **fit better** in memory **caches**, not only resulting in **better performance** for the FSM instance itself, and also leaving more **resources available** to be used by the other parts of the host application.

Additionally, low memory requirements make [HFSM2](https://github.com/andrew-gresyk/HFSM2) a **good fit** for the memory-constrained environments including **embedded** systems and **robotics**.

## Powerful Feature Set

[HFSM2](https://github.com/andrew-gresyk/HFSM2) evolution is driven by the **development experience** rather than dry mathematical theory.

The tools provided by the library are not restricted to conform to an external standard, and the ideas for the **new features** come from from both the **solutions** to the **typical** problems encountered in development, and **competing** decision making **methodologies**, including behavior trees, utility theory and AI planners.

## No Artificial Limitations

[HFSM2](https://github.com/andrew-gresyk/HFSM2) will not hold you back following questionable conventions.\
It's goal is to **empower the developer** instead.

It does not support any artificial standards (including UML), but rather **provides tools** that make sense in a given setting.

There are no superfluous **transition tables**, beyond the one **defined implicitly** in your client code.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.hfsm.dev/general-information/development-principles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
