René's URL Explorer Experiment


Title: Regression in compilation time and memory in Purescript > 0.15.2 · Issue #4491 · purescript/purescript · GitHub

Open Graph Title: Regression in compilation time and memory in Purescript > 0.15.2 · Issue #4491 · purescript/purescript

X Title: Regression in compilation time and memory in Purescript > 0.15.2 · Issue #4491 · purescript/purescript

Description: Description Regression in compilation time and memory in Purescript 0.15.9 (likely introduced in Purescript 0.15.3 by #3915). At Lumi, we have a large "Types" which is generated from Haskell datatypes and custom generic code. This file i...

Open Graph Description: Description Regression in compilation time and memory in Purescript 0.15.9 (likely introduced in Purescript 0.15.3 by #3915). At Lumi, we have a large "Types" which is generated from Haskell dataty...

X Description: Description Regression in compilation time and memory in Purescript 0.15.9 (likely introduced in Purescript 0.15.3 by #3915). At Lumi, we have a large "Types" which is generated from Hask...

Opengraph URL: https://github.com/purescript/purescript/issues/4491

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression in compilation time and memory in Purescript > 0.15.2","articleBody":"## Description\r\n\r\nRegression in compilation time and memory in Purescript 0.15.9 (likely introduced in Purescript 0.15.3 by  https://github.com/purescript/purescript/pull/3915). \r\n\r\nAt Lumi, we have a large \"Types\" which is generated from Haskell datatypes and custom generic code. This file is always the slowest in our compilation chain, however it significantly worsened when we tried upgrading from 0.14.7. The purs compiler RAM usage was most significant, growing to 30GB of ram during the compilation phase. @MonoidMusician recommended I try Purescript 0.15.2, and while there was a small increase from 0.14.7, the RAM was only 2GB during compilation of the large types file.\r\n\r\n## To Reproduce\r\n\r\nThe Types file has 430 newtypes and 250 data type definitions and otherwise contains only instances. A sample newtype definition looks like:\r\n\r\n```purescript\r\nnewtype Address\r\n  = Address\r\n    { \"id\" :: Key Address\r\n    , \"status\" :: LocationStatus\r\n    , \"name\" :: Maybe String\r\n    , \"type_\" :: Maybe AddressType\r\n    , \"fullName\" :: String\r\n    , \"company\" :: Maybe String\r\n    , \"address\" :: String\r\n    , \"aptSuite\" :: Maybe String\r\n    , \"city\" :: String\r\n    , \"country\" :: String\r\n    , \"state\" :: Maybe String\r\n    , \"postalCode\" :: Maybe String\r\n   }\r\n\r\nderive instance genericAddress :: Generic Address _\r\nderive instance newtypeAddress :: Newtype Address _\r\n\r\ninstance decodeAddress :: Decode Address where\r\n  decode = genericDecode jsonOptions\r\n\r\ninstance encodeAddress :: Encode Address where\r\n  encode = genericEncode jsonOptions\r\n```\r\nThe Encode/Decode instances use purescript-foreign (the working groups port to 15.x). At first I thought maybe this library's approach was introducing a regression but I did a POC to switch to argonaught generics and found similar, if not slightly worse compiler performance.\r\n\r\nThere are also some polymorphic types such as:\r\n```purescript\r\nnewtype ApiResponse a1 a0\r\n  = ApiResponse\r\n    { \"warnings\" :: Array a1\r\n    , \"result\" :: a0\r\n    }\r\n\r\nderive instance genericApiResponse :: Generic (ApiResponse a1 a0) _\r\nderive instance newtypeApiResponse :: Newtype (ApiResponse a1 a0) _\r\n\r\ninstance decodeApiResponse :: (Decode a1, Decode a0, DecodeWithOptions a1, DecodeWithOptions a0) => Decode (ApiResponse a1 a0) where\r\n  decode = genericDecode jsonOptions\r\n\r\ninstance encodeApiResponse :: (Encode a1, Encode a0, EncodeWithOptions a1, EncodeWithOptions a0) => Encode (ApiResponse a1 a0) where\r\n  encode = genericEncode jsonOptions\r\n```\r\n\r\nA sample data type is:\r\n\r\n```purescript\r\ndata ClientUpdate\r\n  = ClientSetAssignedUser\r\n    (Maybe (Key User))\r\n  | ClientReactivate\r\n  | ClientDeactivate\r\n    ClientDeactivation\r\n\r\nderive instance genericClientUpdate :: Generic ClientUpdate _\r\n\r\ninstance decodeClientUpdate :: Decode ClientUpdate where\r\n  decode = genericDecode jsonOptions\r\n\r\ninstance encodeClientUpdate :: Encode ClientUpdate where\r\n  encode = genericEncode jsonOptions\r\n```\r\n\r\n\r\n## Expected behavior\r\n\r\nThe purs compiler takes no more than 2GB during compilation. \r\n\r\n## Additional context\r\n\r\nThis has been tested so far on a Mac M1. With Purescript 15.9 I was using the arm binaries and for 15.2 the x86 with rosetta emulation. I can also get some statistics on Linux if that would be helpful.\r\n\r\nWe also attempted generation of non-generic encodings. This definitely had a large impact on compilation memory and time, bringing it down to a more manageable  ~8GB RAM but still elevated more than 15.2.\r\n\r\n## PureScript version\r\n\r\n0.15.9\r\n","author":{"url":"https://github.com/mjrussell","@type":"Person","name":"mjrussell"},"datePublished":"2023-07-21T16:09:18Z","url":"https://github.com/purescript/purescript/issues/4491"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8a4d2792-e895-e2bb-e75d-e115e7900408
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id90B8:21E3E7:61D90C:837CD1:6B00D2EA
html-safe-noncedcc5597b86c865c01eff06221a64b99260d06f64a8274f000151573ee9d96438
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEI4OjIxRTNFNzo2MUQ5MEM6ODM3Q0QxOjZCMDBEMkVBIiwidmlzaXRvcl9pZCI6IjMxNzkzNzY5Nzg5MTAzMDI5NTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac65955239bb31cb3195c88d657b136741a3a7bcf3c5ada40326c6373a79f7e0b3
hovercard-subject-tagissue:1816057570
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript/purescript/4491/issue_layout
twitter:imagehttps://opengraph.githubassets.com/95ad24c0982916474d006c760c7598a733518f552b2f324003106c2507f127cf/purescript/purescript/issues/4491
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/95ad24c0982916474d006c760c7598a733518f552b2f324003106c2507f127cf/purescript/purescript/issues/4491
og:image:altDescription Regression in compilation time and memory in Purescript 0.15.9 (likely introduced in Purescript 0.15.3 by #3915). At Lumi, we have a large "Types" which is generated from Haskell dataty...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemjrussell
hostnamegithub.com
expected-hostnamegithub.com
None85bbdfe2b6ba16e234513bc6ceff5d848ef8449820c900692a2b4e67061931e5
turbo-cache-controlno-preview
go-importgithub.com/purescript/purescript git https://github.com/purescript/purescript.git
octolytics-dimension-user_id6556677
octolytics-dimension-user_loginpurescript
octolytics-dimension-repository_id13206906
octolytics-dimension-repository_nwopurescript/purescript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id13206906
octolytics-dimension-repository_network_root_nwopurescript/purescript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4943239a6d2c591325dad6e5c313e1cafda877f6
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/purescript/purescript/issues/4491#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript%2Fpurescript%2Fissues%2F4491
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript%2Fpurescript%2Fissues%2F4491
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=purescript%2Fpurescript
Reloadhttps://github.com/purescript/purescript/issues/4491
Reloadhttps://github.com/purescript/purescript/issues/4491
Reloadhttps://github.com/purescript/purescript/issues/4491
purescripthttps://github.com/purescript
purescripthttps://github.com/purescript/purescript
Codehttps://github.com/purescript/purescript
Issues280 (280)https://github.com/purescript/purescript/issues
Pull requests28 (28)https://github.com/purescript/purescript/pulls
Actionshttps://github.com/purescript/purescript/actions
Projectshttps://github.com/purescript/purescript/projects
Wikihttps://github.com/purescript/purescript/wiki
Security and qualityhttps://github.com/purescript/purescript/security
Insightshttps://github.com/purescript/purescript/insights
https://github.com/purescript/purescript
New issuehttps://github.com/login?return_to=https://github.com/purescript/purescript/issues/4491
New issuehttps://github.com/login?return_to=https://github.com/purescript/purescript/issues/4491
#4521https://github.com/purescript/purescript/pull/4521
#4517https://github.com/purescript/purescript/pull/4517
Regression in compilation time and memory in Purescript > 0.15.2https://github.com/purescript/purescript/issues/4491#top
#4521https://github.com/purescript/purescript/pull/4521
#4517https://github.com/purescript/purescript/pull/4517
performancehttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22performance%22
status: needs infohttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22status%3A%20needs%20info%22
type: bughttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
https://github.com/mjrussell
mjrussellhttps://github.com/mjrussell
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#issue-1816057570
#3915https://github.com/purescript/purescript/pull/3915
@MonoidMusicianhttps://github.com/MonoidMusician
mjrussellhttps://github.com/mjrussell
type: bughttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#event-9886917373
rhendrichttps://github.com/rhendric
performancehttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22performance%22
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#event-9887106319
https://github.com/mjrussell
mjrussellhttps://github.com/mjrussell
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#issuecomment-1646001992
https://discord.com/channels/864614189094928394/873274004704747600/1130613762739679332https://discord.com/channels/864614189094928394/873274004704747600/1130613762739679332
https://github.com/mjrussell
mjrussellhttps://github.com/mjrussell
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#issuecomment-1646337956
#3915https://github.com/purescript/purescript/pull/3915
https://github.com/rhendric
rhendrichttps://github.com/rhendric
on Jul 21, 2023https://github.com/purescript/purescript/issues/4491#issuecomment-1646338826
https://github.com/JordanMartinez
JordanMartinezhttps://github.com/JordanMartinez
on Jul 28, 2023https://github.com/purescript/purescript/issues/4491#issuecomment-1656403805
#4494https://github.com/purescript/purescript/pull/4494
https://github.com/mjrussell
mjrussellhttps://github.com/mjrussell
on Jul 29, 2023https://github.com/purescript/purescript/issues/4491#issuecomment-1656522895
rhendrichttps://github.com/rhendric
status: needs infohttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22status%3A%20needs%20info%22
on Oct 6, 2023https://github.com/purescript/purescript/issues/4491#event-10579441531
mjrussellhttps://github.com/mjrussell
on Nov 23, 2023https://github.com/purescript/purescript/issues/4491#event-11051609800
Uses strict Map to fix a compile time regressionhttps://github.com/mjrussell/purescript/commit/10f007edf977eec5a17026b4183a8cd6c2db06f1
https://docs.github.com/articles/closing-issues-via-commit-messages
10f007ehttps://github.com/mjrussell/purescript/commit/10f007edf977eec5a17026b4183a8cd6c2db06f1
rhendrichttps://github.com/rhendric
completedhttps://github.com/purescript/purescript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#4521https://github.com/purescript/purescript/pull/4521
on Nov 24, 2023https://github.com/purescript/purescript/issues/4491#event-11055419125
rhendrichttps://github.com/rhendric
on Nov 24, 2023https://github.com/purescript/purescript/issues/4491#event-11055419273
Uses strict Map to fix a compile time regression (#4521)https://github.com/purescript/purescript/commit/a915253de357239e62265953f364460bf22d0328
#4521https://github.com/purescript/purescript/pull/4521
https://docs.github.com/articles/closing-issues-via-commit-messages
a915253https://github.com/purescript/purescript/commit/a915253de357239e62265953f364460bf22d0328
Sign up for freehttps://github.com/signup?return_to=https://github.com/purescript/purescript/issues/4491
Sign in to commenthttps://github.com/login?return_to=https://github.com/purescript/purescript/issues/4491
performancehttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22performance%22
status: needs infohttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22status%3A%20needs%20info%22
type: bughttps://github.com/purescript/purescript/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.