Commit 2ee31aa
src: remove extra heap allocations in CipherBase
Don't allocate + copy + free; allocate and fill in place, then hand off
the pointer to Buffer::New().
Avoids unnecessary heap allocations in the following methods:
- crypto.Cipher#final()
- crypto.Cipher#update()
- crypto.Cipheriv#final()
- crypto.Cipheriv#update()
- crypto.Decipher#final()
- crypto.Decipher#update()
- crypto.Decipheriv#final()
- crypto.Decipheriv#update()
- crypto.privateDecrypt()
- crypto.privateEncrypt()
- crypto.publicDecrypt()
- crypto.publicEncrypt()
PR-URL: #14122
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>1 parent 1444601 commit 2ee31aa
1 file changed
+12
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3561 | 3561 | | |
3562 | 3562 | | |
3563 | 3563 | | |
3564 | | - | |
| 3564 | + | |
3565 | 3565 | | |
3566 | 3566 | | |
3567 | 3567 | | |
| |||
3595 | 3595 | | |
3596 | 3596 | | |
3597 | 3597 | | |
3598 | | - | |
| 3598 | + | |
3599 | 3599 | | |
3600 | 3600 | | |
3601 | 3601 | | |
3602 | 3602 | | |
3603 | 3603 | | |
3604 | 3604 | | |
3605 | 3605 | | |
3606 | | - | |
3607 | | - | |
3608 | | - | |
| 3606 | + | |
3609 | 3607 | | |
3610 | 3608 | | |
3611 | 3609 | | |
| |||
3633 | 3631 | | |
3634 | 3632 | | |
3635 | 3633 | | |
3636 | | - | |
| 3634 | + | |
| 3635 | + | |
3637 | 3636 | | |
3638 | 3637 | | |
3639 | 3638 | | |
| |||
3670 | 3669 | | |
3671 | 3670 | | |
3672 | 3671 | | |
3673 | | - | |
| 3672 | + | |
3674 | 3673 | | |
3675 | 3674 | | |
3676 | 3675 | | |
| |||
3684 | 3683 | | |
3685 | 3684 | | |
3686 | 3685 | | |
3687 | | - | |
| 3686 | + | |
3688 | 3687 | | |
3689 | 3688 | | |
3690 | 3689 | | |
3691 | 3690 | | |
3692 | | - | |
3693 | 3691 | | |
3694 | 3692 | | |
3695 | 3693 | | |
| |||
4560 | 4558 | | |
4561 | 4559 | | |
4562 | 4560 | | |
4563 | | - | |
| 4561 | + | |
4564 | 4562 | | |
4565 | 4563 | | |
4566 | 4564 | | |
| |||
4615 | 4613 | | |
4616 | 4614 | | |
4617 | 4615 | | |
4618 | | - | |
| 4616 | + | |
4619 | 4617 | | |
4620 | 4618 | | |
4621 | 4619 | | |
| |||
4624 | 4622 | | |
4625 | 4623 | | |
4626 | 4624 | | |
4627 | | - | |
4628 | | - | |
4629 | | - | |
4630 | | - | |
| 4625 | + | |
| 4626 | + | |
| 4627 | + | |
4631 | 4628 | | |
4632 | | - | |
4633 | 4629 | | |
4634 | 4630 | | |
4635 | 4631 | | |
| |||
0 commit comments