> For the complete documentation index, see [llms.txt](https://docs.zama.org/tfhe-rs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/tfhe-rs/get-started/benchmarks/cpu/cpu-integer-operations.md).

# Integer

This document details the CPU performance benchmarks of homomorphic operations on integers using **TFHE-rs**.

By their nature, homomorphic operations run slower than their cleartext equivalents.

{% hint style="info" %}
All CPU benchmarks were launched on an `AWS hpc7a.96xlarge` instance equipped with two 96-core `AMD EPYC 9R14 CPU @ 2.60GHz` and 740GB of RAM.
{% endhint %}

The following tables benchmark the execution time of some operation sets using `FheUint` (unsigned integers). The `FheInt` (signed integers) performs similarly.

## Pfail: $$2^{-128}$$

The next tables show the operation timings on CPU when all inputs are encrypted:

### Encrypted/encrypted operations latency

![](/files/JHUAcSje30QnmXtla2ul)

### Encrypted/encrypted operations throughput

![](/files/vQ1E24DPeQdQXuUOO1MV)

The next tables show the operation timings on CPU when the left input is encrypted and the right is a clear scalar of the same size:

### Encrypted/clear operations latency

![](/files/FhMDqF8leK1TpBuxYCGs)

### Encrypted/clear operations throughput

![](/files/XTzGejFSNu15nLJq5rCF)

All timings are based on parallelized Radix-based integer operations where each block is encrypted using the default parameters `PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M128`. To ensure predictable timings, we perform operations in the `default` mode, which ensures that the input and output encoding are similar (i.e., the carries are always emptied).

You can minimize operational costs by selecting from 'unchecked', 'checked', or 'smart' modes from [the fine-grained APIs](/tfhe-rs/references/fine-grained-apis/quick-start.md), each balancing performance and correctness differently. For more details about parameters, see [here](/tfhe-rs/references/fine-grained-apis/shortint/parameters.md). You can find the benchmark results on GPU for all these operations on GPU [here](/tfhe-rs/get-started/benchmarks/gpu.md) and on HPU [here](/tfhe-rs/hardware-acceleration/run-on-hpu/benchmark.md).

## Reproducing TFHE-rs benchmarks

**TFHE-rs** benchmarks can be easily reproduced from the [source](https://github.com/zama-ai/tfhe-rs).

{% hint style="info" %}
AVX512 is now enabled by default for benchmarks when available
{% endhint %}

The following example shows how to reproduce **TFHE-rs** benchmarks:

```shell
#Integer benchmarks:
make bench_integer
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.zama.org/tfhe-rs/get-started/benchmarks/cpu/cpu-integer-operations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
