Skip to content

Conversation

@logicalmechanism
Copy link
Owner

Catching up for 1.30.0.0

francolq and others added 30 commits September 8, 2023 18:08
result -> acc
Add value.reduce into transaction/value.ak
  That last test show that we actually can provide policy ids out of order.
  Looking at Aiken's repositories in the wild, no one is using Dict with
  anything else than ByteArray as key. The extra complexity we bring
  just for making it generic in the key argument seems not worth it.

  Plus, if we know the key is a ByteArray, we can perform some
  optimizations on a few functions looking for keys to short-circuit
  them instead of traversing a list entirely.

  Here's a comparison of the mem and cpu cost before and after the
  chance for a few tests (omitted tests have identical cost).

  | mem     | cpu     | bench                     |
  | ---     | ---     | ---                       |
  | -10.15% | -5.88%  | delete_3                  |
  | -4.00%  | -9.68%  | delete_4                  |
  | -3.80%  | -9.39%  | delete_5                  |
  | -31.03% | -42.88% | delete_6                  |
  | -15.26% | -26.34% | find_4                    |
  | -11.10% | -18.85% | from_list_2               |
  | -8.02%  | -16.26% | from_list_3               |
  | -12.15% | -25.39% | from_list_4               |
  | -19.24% | -36.11% | bench_from_list           |
  | -17.79% | -18.91% | bench_from_ascending_list |
  | -4.91%  | -10.58% | get_2                     |
  | -9.49%  | -14.63% | get_3                     |
  | -29.94% | -42.75% | get_4                     |
  | -23.66% | -37.70% | get_5                     |
  | -7.94%  | -5.03%  | has_key_3                 |
  | -9.97%  | -18.50% | has_key_4                 |
  | -16.46% | -23.61% | insert_1                  |
  | -16.52% | -26.24% | insert_2                  |
  | -13.82% | -22.08% | insert_with_1             |
  | -18.77% | -29.88% | insert_with_2             |
  | -19.12% | -30.52% | insert_with_3             |
  | -10.47% | -17.40% | keys_2                    |
  | 4.25%   | 5.06%   | map_1                     |
  | 2.94%   | 3.31%   | map_2                     |
  | -10.99% | -19.83% | size_3                    |
  | -7.94%  | -16.17% | union_1                   |
  | -17.74% | -28.17% | union_3                   |
  | -16.96% | -26.55% | union_4                   |
  | -15.91% | -25.10% | union_with_1              |
  | -10.47% | -17.39% | values_2                  |
  Unlike `Dict`, `Map` have no invariant and are simply mere wrapper
  around a list of pairs. Functions make no assumption about order of
  the keys and this is translated into the API which facilitate the
  access to underlying elements in various ways.

  Co-authored-by: KtorZ <[email protected]>
@logicalmechanism logicalmechanism added the enhancement New feature or request label Jun 24, 2024
@logicalmechanism logicalmechanism self-assigned this Jun 24, 2024
@logicalmechanism logicalmechanism merged commit 9b3e5ae into plutus-v3 Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants