Title: Program transformation to uncurry functions for which all applications are fully saturated. · Issue #24 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Program transformation to uncurry functions for which all applications are fully saturated. · Issue #24 · purescript-lua/purescript-lua
X Title: Program transformation to uncurry functions for which all applications are fully saturated. · Issue #24 · purescript-lua/purescript-lua
Description: Problem Curried functions compile to nested closures. This local add = function(x) return function(y) return x + y end end is about two times slower than local add = function(x, y) return x + y end Approach Rewrite the former shape into ...
Open Graph Description: Problem Curried functions compile to nested closures. This local add = function(x) return function(y) return x + y end end is about two times slower than local add = function(x, y) return x + y end...
X Description: Problem Curried functions compile to nested closures. This local add = function(x) return function(y) return x + y end end is about two times slower than local add = function(x, y) return x + y end...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/24
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Program transformation to uncurry functions for which all applications are fully saturated.","articleBody":"## Problem\n\nCurried functions compile to nested closures. This\n\n```lua\nlocal add = function(x)\n return function(y)\n return x + y\n end\nend\n```\n\nis about two times slower than\n\n```lua\nlocal add = function(x, y)\n return x + y\nend\n```\n\n## Approach\n\nRewrite the former shape into the latter, but only for functions that are *always* fully applied — i.e. no partial application such as `add(i)` ever happens in the program being compiled. The applications must be rewritten to match:\n\n```lua\nadd(x)(y) ===> add(x, y)\n```\n\n## Prerequisites / Relations\n\nDepends on #179, which introduces the n-ary `AppN` node this transformation emits and consumes. In turn this unblocks #181 (loopification of self-recursive tail calls, which needs uncurried workers).\n\n## Verification / Measurement\n\nA function that is only ever fully applied is emitted as a single multi-argument Lua function with its call sites lowered to direct `f(x, y)` calls (no intermediate closures), while a function with any partial application in the program is left curried. Curried-application overhead is ~4.3x under PUC and ~54x under LuaJIT today, so the win is the removal of that overhead on the rewritten call sites.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2024-04-26T16:49:32Z","url":"https://github.com/purescript-lua/purescript-lua/issues/24"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d50c39fa-d8cb-ae81-da88-5350d10af902 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C90C:19E4BB:635D52:80C879:6B00DFB1 |
| html-safe-nonce | e5d5c3c3810a74257ac1e40351bf04f6942d2458665322974b2eb6778ababd3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTBDOjE5RTRCQjo2MzVENTI6ODBDODc5OjZCMDBERkIxIiwidmlzaXRvcl9pZCI6IjEwNzEyODMzODIyMjAwMjE2ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fbd2ac5893deda5fcc9b94f9fdb4f8af3cca483d17575ceebf6dc902b040be87 |
| hovercard-subject-tag | issue:2266152932 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/24/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ed3bedfc41d47fc93c9f174643c9a0d7a2c21157c0c06909dca06e3c453943d0/purescript-lua/purescript-lua/issues/24 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ed3bedfc41d47fc93c9f174643c9a0d7a2c21157c0c06909dca06e3c453943d0/purescript-lua/purescript-lua/issues/24 |
| og:image:alt | Problem Curried functions compile to nested closures. This local add = function(x) return function(y) return x + y end end is about two times slower than local add = function(x, y) return x + y end... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width