{"id":17963723,"url":"https://github.com/almasb/fxgl-fastrender","last_synced_at":"2025-07-11T04:39:52.488Z","repository":{"id":68008872,"uuid":"327290683","full_name":"AlmasB/FXGL-FastRender","owner":"AlmasB","description":"A quick demo of JavaFX PixelBuffer inside an FXGL environment","archived":false,"fork":false,"pushed_at":"2023-03-03T18:25:58.000Z","size":29,"stargazers_count":43,"open_issues_count":2,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-19T09:14:22.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/AlmasB.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}},"created_at":"2021-01-06T11:27:22.000Z","updated_at":"2025-02-04T22:34:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa022d0d-3a52-420c-b1f3-f66bbf5f4241","html_url":"https://github.com/AlmasB/FXGL-FastRender","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlmasB%2FFXGL-FastRender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlmasB%2FFXGL-FastRender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlmasB%2FFXGL-FastRender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlmasB%2FFXGL-FastRender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlmasB","download_url":"https://codeload.github.com/AlmasB/FXGL-FastRender/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245407667,"owners_count":20610231,"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","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-10-29T11:44:29.077Z","updated_at":"2025-03-25T05:32:21.291Z","avatar_url":"https://github.com/AlmasB.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FXGL-FastRender\n\nA quick demo of various approaches of rendering a single pixel (`fillRect(x, y, 1, 1)`) inside an [FXGL](https://github.com/AlmasB/FXGL) environment. There are not many online resources that are easily available to refer to when it comes to JavaFX drawing performance. Hence, the aim of this demo is to help identify the fastest practical approach to draw a bunch of unrelated pixels (e.g. particles), specifically in JavaFX.\n\nNote that the approaches are not tested directly (e.g. testing if calling `method1()` is faster than calling `method2()`). Hence, approaches like `Canvas.fillRect()` are at a natural disadvantage as they do not support multi-threading and therefore we can see a poor result from `CanvasTestApp`.\n\nIt should also be noted that the results below are just a single pass (no comprehensive statistics applied) and they are only for illustrative purposes. Depending on the actual use case (e.g. `drawImage()` or `drawPolygon()`), the results of these approaches might differ.\n\nFinally, if you spot an error in implementation or have suggestions on how to improve performance, contributions are welcome.\n\n![promo](https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/javafx_render_particles.png)\n\n## Run\n\n```\nmvn javafx:run\n```\n\n## CPU-based sample tests (how long it took to compute a frame in ms) - 1M particles\n\n- CanvasTestApp\n\nNote: can only run in 1 thread due to Canvas limitations.\n\n```\nAvg: 68.7463457\nMin: 59.0025\nMax: 106.2289\n```\n\n- CanvasIntBufferTestApp\n\nNote: using its int buffer for speed _and_ having high-level API makes this the most desirable approach.\n\n```\nAvg: 10.3398753\nMin: 8.0649\nMax: 23.9596\n```\n\n- PixelBufferTestApp\n\nNote: there seem to be some flickering issues if fps is low. In addition, no high-level API.\n\n```\nAvg: 10.5120373\nMin: 7.818\nMax: 21.9998\n```\n\n- AWTImageTestApp\n\nNote: better performance than high-level Canvas but slower than Canvas with IntBuffer.\n\n```\nAvg: 45.6501834\nMin: 41.524\nMax: 78.3333\n```\n\n## GPU-based Sample Tests - 10M particles\n\n- PixelBufferGPUTest\n\n(GPU needs to support OpenCL 1.2 / 2 and have appropriate drivers installed).\n\nNote: we can see that with GPU we can run 10M particles and still beat CPU at 1M.\n\n```\nAvg: 8.81632675\nMin: 6.1725\nMax: 11.0581\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmasb%2Ffxgl-fastrender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmasb%2Ffxgl-fastrender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmasb%2Ffxgl-fastrender/lists"}