about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2021-01-31 01:47:36 +0100
committerGitHub <noreply@github.com>2021-01-31 01:47:36 +0100
commitfd868d02d150ce5cd73fbe7f3aee06ca14333ac8 (patch)
tree1d43be785a8a630eb4bb3d4667e2de9e11073d08 /src/test/codegen/src-hash-algorithm
parent3e8ae5dcba4e5ad2f9a543df8da1ea679d84e4ce (diff)
parentada714d9ce80748d6820565135397e46662ace9b (diff)
downloadrust-fd868d02d150ce5cd73fbe7f3aee06ca14333ac8.tar.gz
rust-fd868d02d150ce5cd73fbe7f3aee06ca14333ac8.zip
Rollup merge of #81484 - Kogia-sima:perf/optimize-udiv_1e19, r=nagisa
Optimize decimal formatting of 128-bit integers

## Description

This PR optimizes the `udivmod_1e19` function, which is used for formatting 128-bit integers, based on the algorithm provided in \[1\]. This optimization improves performance of formatting 128-bit integers, especially on 64-bit architectures. It also slightly reduces the output binary size.

## Assembler comparison

https://godbolt.org/z/YrG5zY

## Performance

#### previous results

```
test fmt::write_u128_max                                        ... bench:         552 ns/iter (+/- 4)
test fmt::write_u128_min                                        ... bench:         125 ns/iter (+/- 2)
```

#### new results

```
test fmt::write_u128_max                                        ... bench:         205 ns/iter (+/- 13)
test fmt::write_u128_min                                        ... bench:         129 ns/iter (+/- 5)
```

## Reference

\[1\] T. Granlund and P. Montgomery, “Division by Invariant Integers Using Multiplication” in Proc. of the SIGPLAN94 Conference on Programming Language Design and Implementation, 1994, pp. 61–72
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions