# Large Specs

> Keep RapiDoc fast with specs of several megabytes and thousands of operations.

RapiDoc renders specs with over a thousand operations, but large specs need the right settings. In order of impact:

## 1. Use `view` or `focused` mode

`read` mode renders every operation at once. On an 8 MB spec with 1,128 operations it takes about 6 seconds, against about 1 second in `view` or `focused` mode (see [Render Modes](/docs/rapidoc/performance/render-modes/#measured-load-times)).

```html
<rapi-doc spec-url="/openapi.json" render-style="focused"></rapi-doc>
```

## 2. Convert Swagger 2.0 ahead of time

A Swagger 2.0 spec is upgraded to OpenAPI 3.x in the reader's browser on every page load. For a large spec, convert it once in your build instead:

<Steps>

1. Convert the spec:

   ```bash
   npx swagger2openapi swagger.json --outfile openapi.json
   ```

2. Point RapiDoc at the converted file:

   ```html
   <rapi-doc spec-url="/openapi.json"></rapi-doc>
   ```

</Steps>

## 3. Collapse schemas

By default, schemas start fully expanded. Large, deeply nested schemas render faster when they start collapsed:

```html
<rapi-doc
  spec-url="/openapi.json"
  render-style="focused"
  schema-expand-level="1"
  default-schema-tab="schema"
></rapi-doc>
```

- `schema-expand-level="1"`: only the first level of each schema is open; readers expand the rest.
- `default-schema-tab="schema"`: request and response bodies open on the schema tab instead of the example tab, so example blocks aren't drawn until a reader opens them.

## 4. Mind the structure, not just the size

File size matters less than structure. Long Markdown descriptions cost little; what slows rendering is the number of operations and how large and deeply nested their schemas are once `$ref`s are resolved. A schema referenced by hundreds of operations is rendered once for each of them.
