{"id":21718212,"url":"https://github.com/protonull/bonkersvarargscompiletest","last_synced_at":"2025-09-10T10:34:02.821Z","repository":{"id":209145210,"uuid":"723339427","full_name":"Protonull/BonkersVarargsCompileTest","owner":"Protonull","description":"Turns out, type inference in varargs is REALLY BAD","archived":false,"fork":false,"pushed_at":"2023-11-27T18:55:46.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T14:48:28.684Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Protonull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-25T11:00:26.000Z","updated_at":"2023-11-25T11:20:49.000Z","dependencies_parsed_at":"2023-11-25T12:25:19.942Z","dependency_job_id":"cc086869-5ba9-4524-9ac4-d17464ad52d7","html_url":"https://github.com/Protonull/BonkersVarargsCompileTest","commit_stats":null,"previous_names":["protonull/bonkersvarargscompiletest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Protonull/BonkersVarargsCompileTest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protonull%2FBonkersVarargsCompileTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protonull%2FBonkersVarargsCompileTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protonull%2FBonkersVarargsCompileTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protonull%2FBonkersVarargsCompileTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Protonull","download_url":"https://codeload.github.com/Protonull/BonkersVarargsCompileTest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protonull%2FBonkersVarargsCompileTest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274447536,"owners_count":25287113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T01:24:33.344Z","updated_at":"2025-09-10T10:34:02.793Z","avatar_url":"https://github.com/Protonull.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BonkersVarargsCompileTest\n\nCame across this issue while working on a project fork. There was a class with\nostensibly static data, but were just exposed HashMaps and HashSets, so I used\nJava's Map and Set [ofEntries() methods](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html#ofEntries%28java.util.Map.Entry...%29) \nthat were added in Java 9, but this turned out to increase compilation from\naround 10 seconds to around 11 minutes, a 66x increase.\n\nAfter some asking around and testing, we narrowed it down to vararg type\ninference.\n\n- **ColourConstantsVarargs.java:** This is a direct copy-paste of my edit that\n  ruined my life for two hours.\n\n- **ColourConstantsPremadeVarargs.java:** This was a hacky test to determine\n  whether the auto-generated varargs-array was the problem. (It was.)\n\n- **ColourConstantsCopyOf.java:** This is what the class looked like before my\n  edit, except I've wrapped it in a Map.copyOf() just to see whether there's\n  some issue with Map APIs.\n\n- **ColourConstantsTypedVarargs.java:** This was to test whether removing type\n  inference by making it explicit removes the problem. (It does.)\n\nThere's something in particular about type-inference within an auto-generated\nvarargs array that the compiler just does not like, and causes compilation time\nto massively suffer.\n\n## How to run\n\nClone this repo and execute `sh run.sh`\n\n## Results\n\n```\nopenjdk 17.0.9 2023-10-17 LTS\nOpenJDK Runtime Environment Corretto-17.0.9.8.1 (build 17.0.9+8-LTS)\nOpenJDK 64-Bit Server VM Corretto-17.0.9.8.1 (build 17.0.9+8-LTS, mixed mode, sharing)\n\nCompiling Varargs\nTime: 4:52.91\n\nCompiling Premade Varargs\nTime: 0:00.65\n\nCompiling Copy Of\nTime: 0:00.53\n\nCompiling Typed Varargs\nTime: 0:00.60\n```\n\nHow did you do?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotonull%2Fbonkersvarargscompiletest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotonull%2Fbonkersvarargscompiletest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotonull%2Fbonkersvarargscompiletest/lists"}