{"id":22277104,"url":"https://github.com/mrjameshamilton/simple-java-class-file-api-optimizer","last_synced_at":"2026-03-04T06:03:13.818Z","repository":{"id":264337322,"uuid":"893085963","full_name":"mrjameshamilton/simple-java-class-file-api-optimizer","owner":"mrjameshamilton","description":"A simple Java bytecode optimiser","archived":false,"fork":false,"pushed_at":"2025-03-15T14:13:53.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:52:07.141Z","etag":null,"topics":["bytecode","class-file-api","java","jep457","jep466","jep484","jvm","optimizer","peephole-optimization"],"latest_commit_sha":null,"homepage":"https://jameshamilton.eu/programming/peering-through-peephole-build-peephole-optimiser-using-new-java-24-class-file-api","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrjameshamilton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-11-23T13:52:15.000Z","updated_at":"2025-03-15T14:13:57.000Z","dependencies_parsed_at":"2025-01-30T15:38:14.957Z","dependency_job_id":"95315500-ef1c-468b-861e-6c96ccd4e6f5","html_url":"https://github.com/mrjameshamilton/simple-java-class-file-api-optimizer","commit_stats":null,"previous_names":["mrjameshamilton/simple-java-class-file-api-optimizer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrjameshamilton/simple-java-class-file-api-optimizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fsimple-java-class-file-api-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fsimple-java-class-file-api-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fsimple-java-class-file-api-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fsimple-java-class-file-api-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrjameshamilton","download_url":"https://codeload.github.com/mrjameshamilton/simple-java-class-file-api-optimizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjameshamilton%2Fsimple-java-class-file-api-optimizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30073690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:31:57.858Z","status":"ssl_error","status_checked_at":"2026-03-04T05:31:38.462Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bytecode","class-file-api","java","jep457","jep466","jep484","jvm","optimizer","peephole-optimization"],"created_at":"2024-12-03T14:17:19.380Z","updated_at":"2026-03-04T06:03:13.801Z","avatar_url":"https://github.com/mrjameshamilton.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Java Class File Optimiser\n\nPeephole optimisation is a simple technique that can yield surprisingly good results with little complexity.\nOptimizer.java implements a simple peephole optimiser using the Java Class-File API.\n\nTwo optimisations are implemented, as an example:\n\n* Removal of redundant addition/subtraction of zero e.g. int x = y + 0;\n* Merging of consecutive StringBuilder.append calls with constant strings \ne.g. sb.append(\"foo\").append(\"bar\") -\u003e sb.append(\"foobar\");\n\nThe optimiser uses the Java Class-File API (JEP 457 / 466 / 484) released\nin final form in Java 24. The Optimizer.java source file is self-contained\nand does not require any external dependencies apart from the Java 24 standard library.\n\nFurther details can be found in [the accompanying blog post](https://jameshamilton.eu/programming/peering-through-peephole-build-peephole-optimiser-using-new-java-24-class-file-api).\n\n# Run\n\nYou'll need JDK 24, the easiest way to install this, on Linux, is with [SDK man](https://sdkman.io/):\n\n```shell\nsdk install java 24.ea.36-open\n```\n\nYou can run the optimizer directly from source using the java command:\n\n```shell\n$ java Optimizer.java input.jar output.jar\n```\n\n# Test case\n\nThe TestJarGenerator.java can generate a test jar to showcase the two optimisations\nthat are applied:\n\n```shell\n$ java TestJarGenerator.java test.jar\n$ java Optimizer.java test.jar optimized.jar\n$ java -jar test.jar\n$ java -jar optimized.jar\n```\n\nThe script `run.sh` runs the test jar generator and the optimizer in one go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjameshamilton%2Fsimple-java-class-file-api-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrjameshamilton%2Fsimple-java-class-file-api-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjameshamilton%2Fsimple-java-class-file-api-optimizer/lists"}