You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There isn't much difference when you benchmark it (in the scenario that article tested)
All of my sources here are reddit comments (😅 ) so it would be interesting to confirm:
That the compiler will optimize-away borrows of small structs
That the compiler will under the hood borrow large structs rather than copying them
We're not going to get some big performance gain here, so this really is more an intellectual exercise / matter of standardizing how we do things. Seems reasonable to update docs to advise:
If < 64 bytes -> Copy
If > 64 bytes -> &borrow
This way we're covered even if the compiler isn't being super smart (on my to-do list to figure out if it is).
The text was updated successfully, but these errors were encountered:
This is very low priority, I just found it interesting 🦀
In
sim-ln
we borrow&PublicKey
when we pass it to functions, rather than copying it (PublicKey
).By contrast, LDK mostly just copies around
PublicKey
.I was interested in when we should borrow vs copy smaller structs, and did some digging:
All of my sources here are reddit comments (😅 ) so it would be interesting to confirm:
We're not going to get some big performance gain here, so this really is more an intellectual exercise / matter of standardizing how we do things. Seems reasonable to update docs to advise:
Copy
&
borrowThis way we're covered even if the compiler isn't being super smart (on my to-do list to figure out if it is).
The text was updated successfully, but these errors were encountered: