# Compression

**DOTSNET** is extremely fast. It’s so fast, that we are currently bandwidth limited. The more we optimize bandwidth, the more Entities we can sync over the network.

**DOTSNET** has a Compression class with a few helper functions like`De/CompressQuaternion`. Those can be used in NetworkMessage `Serialize`/`Deserialize` functions to compress data.

For example, writing a `quaternion` rotation usually takes **16 bytes**:

```csharp
public bool Serialize(ref BitWriter writer) =>
    writer.WriteQuaternion(rotation);
```

But most of the time we can compress it down to **4 bytes**:

```csharp
public bool Serialize(ref SegmentWriter writer) =>
    writer.WriteQuaternionSmallestThree(rotation);
```

If you run into bandwidth issues, you will understand why we go through the hassle of compression.


---

# 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://dotsnet.gitbook.io/docs/user-manual/compression.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.
