Skip to content

Conversation

@nkysg
Copy link

@nkysg nkysg commented Oct 31, 2024

TITLE

Description

Description of the pull request changes and motivation.
use Vec::with_capacity avoid realloc memory

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

@pefontana
Copy link
Collaborator

Hi @nkysg !
Thanks for the contribution!
Do you have any benchmark to see if the PR improves the performance?

@pefontana
Copy link
Collaborator

pefontana commented Nov 1, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
2.522 ± 0.044 2.457 2.636 1.00
2.563 ± 0.006 2.553 2.573 1.02 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
2.428 ± 0.037 2.394 2.508 1.00
2.515 ± 0.022 2.497 2.564 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
9.358 ± 0.414 9.093 10.511 1.01 ± 0.05
9.230 ± 0.087 9.158 9.472 1.00
Command Mean [s] Min [s] Max [s] Relative
2.612 ± 0.066 2.543 2.718 1.00
2.685 ± 0.060 2.645 2.798 1.03 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
1.703 ± 0.027 1.669 1.757 1.00
1.780 ± 0.032 1.754 1.853 1.05 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
1.436 ± 0.012 1.418 1.457 1.00
1.458 ± 0.013 1.442 1.486 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
9.393 ± 0.400 9.068 10.386 1.01 ± 0.04
9.315 ± 0.082 9.246 9.520 1.00
Command Mean [s] Min [s] Max [s] Relative
9.740 ± 0.537 9.369 10.747 1.00 ± 0.06
9.728 ± 0.306 9.518 10.499 1.00
Command Mean [s] Min [s] Max [s] Relative
2.563 ± 0.035 2.508 2.609 1.00
2.644 ± 0.036 2.620 2.729 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
1.736 ± 0.027 1.706 1.799 1.00
1.804 ± 0.008 1.794 1.822 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
1.689 ± 0.028 1.658 1.755 1.00
1.758 ± 0.010 1.743 1.774 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
1.404 ± 0.014 1.391 1.434 1.00
1.499 ± 0.012 1.482 1.520 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
1.817 ± 0.025 1.783 1.875 1.00
1.871 ± 0.022 1.845 1.912 1.03 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
600.4 ± 9.2 591.0 618.6 1.00
609.2 ± 7.3 601.2 625.1 1.01 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
700.3 ± 11.0 688.7 728.4 1.00
718.1 ± 9.0 704.7 739.1 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
2.088 ± 0.036 2.053 2.140 1.00
2.102 ± 0.018 2.084 2.146 1.01 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
698.8 ± 4.8 693.4 710.0 1.00
727.1 ± 12.3 708.0 742.5 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
5.050 ± 0.054 4.981 5.112 1.00
5.174 ± 0.062 5.123 5.338 1.02 ± 0.02

state = blake_round(state, message, sigma_list);
}
let mut new_state = Vec::<u32>::new();
let mut new_state = Vec::<u32>::with_capacity(8);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a bottleneck, it'd make more sense to return an array.

@Oppen
Copy link
Contributor

Oppen commented Nov 4, 2024

The performance changes look more like a slight slowdown than a speedup.

@FrancoGiachetta
Copy link
Contributor

Closing this PR as It shows a slowdown rather than a speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants