docs: update old [tag] -> @[tag] (#22036)

This commit is contained in:
Carlos Esquerdo Bernat 2024-08-12 13:31:03 +02:00 committed by GitHub
parent c69dfefedb
commit e8305d240c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6686,10 +6686,10 @@ performance, memory usage, or size.
| Tuning Operation | Benefits | Drawbacks | | Tuning Operation | Benefits | Drawbacks |
|--------------------------|---------------------------------|---------------------------------------------------| |--------------------------|---------------------------------|---------------------------------------------------|
| `[inline]` | Performance | Increased executable size | | `@[inline]` | Performance | Increased executable size |
| `[direct_array_access]` | Performance | Safety risks | | `@[direct_array_access]` | Performance | Safety risks |
| `[packed]` | Memory usage | Potential performance loss | | `@[packed]` | Memory usage | Potential performance loss |
| `[minify]` | Performance, Memory usage | May break binary serialization/reflection | | `@[minify]` | Performance, Memory usage | May break binary serialization/reflection |
| `_likely_/_unlikely_` | Performance | Risk of negative performance impact | | `_likely_/_unlikely_` | Performance | Risk of negative performance impact |
| `-skip-unused` | Performance, Compile time, Size | Potential instability | | `-skip-unused` | Performance, Compile time, Size | Potential instability |
| `-fast-math` | Performance | Risk of incorrect mathematical operations results | | `-fast-math` | Performance | Risk of incorrect mathematical operations results |
@ -6699,9 +6699,9 @@ performance, memory usage, or size.
### Tuning operations details ### Tuning operations details
#### `[inline]` #### `@[inline]`
You can tag functions with `[inline]`, so the C compiler will try to inline them, which in some You can tag functions with `@[inline]`, so the C compiler will try to inline them, which in some
cases, may be beneficial for performance, but may impact the size of your executable. cases, may be beneficial for performance, but may impact the size of your executable.
**When to Use** **When to Use**
@ -6713,9 +6713,9 @@ cases, may be beneficial for performance, but may impact the size of your execut
- Large functions, as it might cause code bloat and actually decrease performance. - Large functions, as it might cause code bloat and actually decrease performance.
- Large functions in `if` expressions - may have negative impact on instructions cache. - Large functions in `if` expressions - may have negative impact on instructions cache.
#### `[direct_array_access]` #### `@[direct_array_access]`
In functions tagged with `[direct_array_access]` the compiler will translate array operations In functions tagged with `@[direct_array_access]` the compiler will translate array operations
directly into C array operations - omitting bounds checking. This may save a lot of time in a directly into C array operations - omitting bounds checking. This may save a lot of time in a
function that iterates over an array but at the cost of making the function unsafe - unless the function that iterates over an array but at the cost of making the function unsafe - unless the
boundaries will be checked by the user. boundaries will be checked by the user.
@ -6729,10 +6729,10 @@ sure that the access index will be valid.
- Everywhere else. - Everywhere else.
#### `[packed]` #### `@[packed]`
The `@[packed]` attribute can be applied to a structure to create an unaligned memory layout, The `@[packed]` attribute can be applied to a structure to create an unaligned memory layout,
which decreases the overall memory footprint of the structure. Using the `[packed]` attribute which decreases the overall memory footprint of the structure. Using the `@[packed]` attribute
may negatively impact performance or even be prohibited on certain CPU architectures. may negatively impact performance or even be prohibited on certain CPU architectures.
**When to Use** **When to Use**
@ -6744,7 +6744,7 @@ may negatively impact performance or even be prohibited on certain CPU architect
- On CPU architectures that do not support unaligned memory access or when high-speed memory access - On CPU architectures that do not support unaligned memory access or when high-speed memory access
is needed. is needed.
#### `[aligned]` #### `@[aligned]`
The `@[aligned]` attribute can be applied to a structure or union to specify a minimum alignment The `@[aligned]` attribute can be applied to a structure or union to specify a minimum alignment
(in bytes) for variables of that type. Using the `@[aligned]` attribute you can only *increase* (in bytes) for variables of that type. Using the `@[aligned]` attribute you can only *increase*
@ -6783,10 +6783,10 @@ is CPU specific, and the compiler already usually will choose a good default for
See also ["What Every Programmer Should Know About Memory", by Ulrich Drepper](https://people.freebsd.org/~lstewart/articles/cpumemory.pdf) . See also ["What Every Programmer Should Know About Memory", by Ulrich Drepper](https://people.freebsd.org/~lstewart/articles/cpumemory.pdf) .
#### `[minify]` #### `@[minify]`
The `[minify]` attribute can be added to a struct, allowing the compiler to reorder the fields in The `@[minify]` attribute can be added to a struct, allowing the compiler to reorder the fields in
a way that minimizes internal gaps while maintaining alignment. Using the `[minify]` attribute may a way that minimizes internal gaps while maintaining alignment. Using the `@[minify]` attribute may
cause issues with binary serialization or reflection. Be mindful of these potential side effects cause issues with binary serialization or reflection. Be mindful of these potential side effects
when using this attribute. when using this attribute.