-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IfThenElse
to the AST
#6578
Comments
16% is crazy. If that number is actually correct then I personally would prefer any amount of awkwardness over 15% of all byte-code being force/delay. That’s an extremely large performance tradeoff just to avoid awkwardness. |
Weren't you the person who said "The cost of bytes is so low" recently? 😛 Seriously though:
I don't know how 16% of I was explicitly told that I should not spend any significant amount of time improving performance after I'd invested some effort in that as this wasn't deemed a priority. The latter is the reason why things don't become faster, not our lack of imagination. Also, |
The cost of storage bytes is relatively low, but the deserialization fee per reference script byte is extremely high. So much so that most major dApp protocol revenue was cut in half by its introduction.
Were these optimizations to Plutus or to UPLC?
Yes, I personally don't see why core language features (pattern matching
The reason it contributes to performance (by performance I mean in the context of onchain code, the ex-units that dApp developers care about). Is that the most impactful optimization techniques in onchain code involve trade-offs between script-size and ex-units. This results in a tight balancing act when making a production smart contract, the goal is to minimize ex-units while keeping the script size below (often as close as possible to) the ~16kb limit. Unrolling recursion, large lookup tables, and aggressive inlining are all powerful optimizations that reduce ex-units at the cost of increasing script size. When 16% of the script size is occupied by force/delay, that is 16% that could be used for either more features in the contract or more optimization via the above techniques.
I don’t know why it was decided that you shouldn’t spend any significant amount of time on performance when that is the number one concern of dApp developers. Aside from smart contract auditing, the vast majority of the contracting work we do at Anastasia Labs is for is smart contract optimization to enhance the throughput of dApp protocols. It is the same for every dApp, a massive amount of time is spent on script optimization (often at the expense of code-readability and occasionally even security), all because without such optimizations, throughput is not sufficient. |
If we would go so far as to actually create an So we can generate UPLC code like:
Instead of:
Such a term would also offer a cleaner and more efficient solution for complicated pattern-matching branches |
Alex Nemish reports on X:
My response was
but we should perhaps at least try adding an
IfThenElse
node to the AST to see how it affects performance. Maybe the awkwardness is worth it.The text was updated successfully, but these errors were encountered: