<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/arti.git/crates/hashx/src/constraints.rs, branch arti-v2.4.0</title>
<subtitle>mirror of https://gitlab.torproject.org/tpo/core/arti
</subtitle>
<id>http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v2.4.0</id>
<link rel='self' href='http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v2.4.0'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/'/>
<updated>2025-08-07T15:28:36Z</updated>
<entry>
<title>Switch Cargo.toml files to edition 2024.</title>
<updated>2025-08-07T15:28:36Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2025-08-06T01:19:58Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=77b0de43b8c67cdb81befe0680a3df43b6ad37bc'/>
<id>urn:sha1:77b0de43b8c67cdb81befe0680a3df43b6ad37bc</id>
<content type='text'>
First, run

```
git grep -l "^edition =" |
    xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;'
```

Second, manually verify that all Cargo.toml files have changed,
and nothing else has changed.

Third, run cargo fmt again.
</content>
</entry>
<entry>
<title>hashx: Cleanup around Instruction and NUM_INSTRUCTIONS</title>
<updated>2023-08-25T20:14:24Z</updated>
<author>
<name>Micah Elizabeth Scott</name>
<email>beth@torproject.org</email>
</author>
<published>2023-08-25T20:11:47Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=2cb50d1be35a4a6623ff318fcf8ac2620521bb1f'/>
<id>urn:sha1:2cb50d1be35a4a6623ff318fcf8ac2620521bb1f</id>
<content type='text'>
This patch tries to make some of the expressions around NUM_INSTRUCTIONS
more convenient. We can import it directly where it's needed, but most
uses are replaced by new type aliases for InstructionArray and
InstructionVec.

No change to any hashx_cachegrind iai benchmarks
</content>
</entry>
<entry>
<title>Rustfmt</title>
<updated>2023-08-24T16:01:44Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2023-08-24T16:01:44Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=b1fd9934a166392e8dc0acada4b5bea376569fb5'/>
<id>urn:sha1:b1fd9934a166392e8dc0acada4b5bea376569fb5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>hashx: FixedCapacityVec: Move into its own module</title>
<updated>2023-08-24T12:50:20Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2023-08-24T12:23:20Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=6529846787aa65dc480edcca4a3e9cab1712e75b'/>
<id>urn:sha1:6529846787aa65dc480edcca4a3e9cab1712e75b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rustfmt</title>
<updated>2023-08-23T11:02:24Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2023-08-23T11:02:24Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=99def36084e65491482cd6871adc8972ccfd82ee'/>
<id>urn:sha1:99def36084e65491482cd6871adc8972ccfd82ee</id>
<content type='text'>
</content>
</entry>
<entry>
<title>RFC: hashx: Introduce FixedCapacityVec</title>
<updated>2023-08-23T10:59:24Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2023-08-23T10:48:40Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=3deb358cd2dd588baa560d347f1e69d078e28d9d'/>
<id>urn:sha1:3deb358cd2dd588baa560d347f1e69d078e28d9d</id>
<content type='text'>
This is quite shoddy.  It shouldn't be merged without some tidying up
and unit tests and so on.  Also I am confused about the difference
between NUM_INSTRUCTIONS and model::REQUIRED_INSTRUCTIONS.

However:

generate_interp_1000x
  Instructions:           220115418 (-1.147100%)
  L1 Accesses:            278918725 (-0.936103%)
  L2 Accesses:                   25 (-98.46248%)
  RAM Accesses:                 414 (-0.956938%)
  Estimated Cycles:       278933340 (-0.938920%)

generate_interp_1000x_c
  Instructions:           272748034 (No change)
  L1 Accesses:            349932970 (+0.000001%)
  L2 Accesses:                   76 (-1.298701%)
  RAM Accesses:                 405 (-0.491400%)
  Estimated Cycles:       349947525 (-0.000021%)

generate_compiled_1000x
  Instructions:           257344624 (-0.982784%)
  L1 Accesses:            343007206 (-0.753942%)
  L2 Accesses:               152502 (-17.12839%)
  RAM Accesses:                 809 (-0.369458%)
  Estimated Cycles:       343798031 (-0.797384%)

generate_compiled_1000x_c
  Instructions:           281855218 (No change)
  L1 Accesses:            362569043 (+0.000002%)
  L2 Accesses:                   87 (-4.395604%)
  RAM Accesses:                 466 (-0.427350%)
  Estimated Cycles:       362585788 (-0.000023%)

interp_u64_hash_1000x
  Instructions:            13451818 (-0.100680%)
  L1 Accesses:             16623452 (-0.105967%)
  L2 Accesses:                   28 (No change)
  RAM Accesses:                 392 (-1.507538%)
  Estimated Cycles:        16637312 (-0.107138%)

interp_8b_hash_1000x_c
  Instructions:             8618541 (No change)
  L1 Accesses:             12316165 (+0.000032%)
  L2 Accesses:                   80 (-2.439024%)
  RAM Accesses:                 428 (-0.465116%)
  Estimated Cycles:        12331545 (-0.000616%)

compiled_u64_hash_100000x
  Instructions:            87312230 (-1.358594%)
  L1 Accesses:             94397055 (-1.669415%)
  L2 Accesses:                  212 (-0.469484%)
  RAM Accesses:                 776 (-0.767263%)
  Estimated Cycles:        94425275 (-1.669144%)

compiled_8b_hash_100000x_c
  Instructions:            91547640 (No change)
  L1 Accesses:             98838176 (+0.000009%)
  L2 Accesses:                  134 (-4.964539%)
  RAM Accesses:                 481 (-0.414079%)
  Estimated Cycles:        98855681 (-0.000097%)
</content>
</entry>
<entry>
<title>hashx: Rearrange destination register validator for performance</title>
<updated>2023-08-21T22:27:28Z</updated>
<author>
<name>Micah Elizabeth Scott</name>
<email>beth@torproject.org</email>
</author>
<published>2023-08-18T21:33:21Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=0af908bcf2b61b67a1f3e876ee938afd2ffd8e56'/>
<id>urn:sha1:0af908bcf2b61b67a1f3e876ee938afd2ffd8e56</id>
<content type='text'>
This hoists a few decisions out of the innermost portions of
choose_dst_reg, by moving what we can out of dst_register_allowed.

Wallclock time benchmarks:
  generate-interp improves, -6.0%

Cachegrind benchmarks:
  generate_interp_1000x, -5.0% instructions, -11.6% L2 access, -6% RAM

Signed-off-by: Micah Elizabeth Scott &lt;beth@torproject.org&gt;
</content>
</entry>
<entry>
<title>hashx: New approach to avoid memcpy in Program</title>
<updated>2023-08-21T22:27:28Z</updated>
<author>
<name>Micah Elizabeth Scott</name>
<email>beth@torproject.org</email>
</author>
<published>2023-08-15T21:35:05Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=ceacd5c98808ed8ecd91d6645be3ad32ce606ad0'/>
<id>urn:sha1:ceacd5c98808ed8ecd91d6645be3ad32ce606ad0</id>
<content type='text'>
I was trying to eliminate all the places where we copied a Program
(about 4100 bytes) except for the one final copy into a Box; but that
approach was proving too annoying. Even returning a Program via Result
will cause multiple unnecessary copies that don't optimize out.

This patch switches approaches, and instead allocates a Vec&lt;Instruction&gt;
presized to the correct capacity. This allocation is made as early as
possible and retained for the lifetime of the program if necessary.
This means we'll never avoid a heap allocation, but we can always
avoid extra copies and we don't need a separate Box for interpreted
programs.

Performance effects are subtle. Overall wallclock time doesn't change
much. Cachegrind shows some accesses moving up from RAM to L2 cache.
Using GDB to probe memcpy sizes shows that large (&gt;1024b) memcpy are now
totally gone in the generate-interp test.

Signed-off-by: Micah Elizabeth Scott &lt;beth@torproject.org&gt;
</content>
</entry>
<entry>
<title>hashx: Rewrite RegisterSet again to reduce CPU frontend stalls</title>
<updated>2023-08-21T22:27:28Z</updated>
<author>
<name>Micah Elizabeth Scott</name>
<email>beth@torproject.org</email>
</author>
<published>2023-08-18T04:19:51Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=ee6acfa5cdd2d79676221f3675daec466cd73e1e'/>
<id>urn:sha1:ee6acfa5cdd2d79676221f3675daec466cd73e1e</id>
<content type='text'>
Closer inspection of the CPU counters showed that the branching in
RegisterSet::index() was a big problem, contributing to the overall
CPU frontend stall bottleneck in program generation.

This new version is less general, and closer to the appraoch used by
the original C implementation. We store a sorted ArrayVec of in-set
registers, and most operations construct the RegisterSet only once
using a combined filter predicate.

Choosing a register from a set is now cheaper in branches, instructions,
and L1 cache space. We now very rarely manipulate an entire RegisterSet
in any way other than by selecting a register randomly. (Just for the
register R5 special case.)

Wallclock time benchmarks:
  generate-interp improves, -7.0%
  generate-x86_64 improves, -7.2%

Cachegrind benchmarks:
  generate_interp_1000x, more total instructions run but a large
  decrease in frontend cache misses. +4.6% instructions, +11% L1
  accesses, -99% L2 access, -40% RAM access.

  generate_compiled_100x, +4.0% instructions, +9.4% L1 access.
  cache miss improvements: -57% L2 access, -25% RAM access.

Signed-off-by: Micah Elizabeth Scott &lt;beth@torproject.org&gt;
</content>
</entry>
<entry>
<title>hashx: new RegisterWriter format handles more cases transparently</title>
<updated>2023-08-21T22:27:28Z</updated>
<author>
<name>Micah Elizabeth Scott</name>
<email>beth@torproject.org</email>
</author>
<published>2023-08-16T22:54:10Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=e142fd988283925660ab109fed3a1d92a36fd0b5'/>
<id>urn:sha1:e142fd988283925660ab109fed3a1d92a36fd0b5</id>
<content type='text'>
There was a special case in writer_pair_allowed for making add and
subtract equivalent. This patch changes RegisterWriter's encoding, using
per-opcode variants instead of per-format variants. The Add/Sub merge
can now happen earlier, when RegisterWriter is constructed.

Before and after RegisterWriter sizes are the same, at 8 bytes.
This patch removes many uses of Option&lt;RegisterWriter&gt; in favor
of using a new RegisterWriter::None default, and passes by value
rather than by reference.

Wallclock time benchmarks:
  generate-interp improves, -7.5%
  generate-x86_64 improves, -5.3%

Cachegrind benchmarks:
  generate_interp_1000x, negligible change in total instructions,
  improvement in cache footprint: -22.8% L2 accesses

Signed-off-by: Micah Elizabeth Scott &lt;beth@torproject.org&gt;
</content>
</entry>
</feed>
