{"id":19838862,"url":"https://github.com/sayi/jmh-visual-chart","last_synced_at":"2025-02-28T19:15:16.937Z","repository":{"id":68717845,"uuid":"164784588","full_name":"Sayi/jmh-visual-chart","owner":"Sayi","description":":bar_chart: A visual chart for Java MicroBenchmark Harness.","archived":false,"fork":false,"pushed_at":"2019-01-30T02:13:24.000Z","size":214,"stargazers_count":41,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-11T11:19:13.352Z","etag":null,"topics":["benchmark","chart","jmh","report","visual"],"latest_commit_sha":null,"homepage":"http://deepoove.com/jmh-visual-chart/","language":"HTML","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/Sayi.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}},"created_at":"2019-01-09T04:01:16.000Z","updated_at":"2024-10-29T03:25:05.000Z","dependencies_parsed_at":"2023-03-06T11:30:46.796Z","dependency_job_id":null,"html_url":"https://github.com/Sayi/jmh-visual-chart","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/Sayi%2Fjmh-visual-chart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sayi%2Fjmh-visual-chart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sayi%2Fjmh-visual-chart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sayi%2Fjmh-visual-chart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sayi","download_url":"https://codeload.github.com/Sayi/jmh-visual-chart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209528,"owners_count":19927734,"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":["benchmark","chart","jmh","report","visual"],"created_at":"2024-11-12T12:19:22.757Z","updated_at":"2025-02-28T19:15:16.915Z","avatar_url":"https://github.com/Sayi.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## JMH-visual-chart\n基于JMH基准测试实现「一组参数不同方法维度」的可视化度量。\n\n**一组参数不同方法维度** 是指参数在不同取值组合情况下，不同方法的基准测试结果的比较。\n\n### QuickStart\n我们以字符串拼接的基准测试为例。\n\n测试在使用加号和StringBuilder时候的字符串拼接的性能情况，拼接次数由变量length指定，分别测试10次、50次和100次的性能，测试代码如下：\n```java\n@BenchmarkMode(Mode.Throughput)\n@Measurement(iterations = 2, time = 6, timeUnit = TimeUnit.SECONDS)\n@Threads(4)\n@Fork(2)\n@Warmup(iterations = 1)\n@State(value = Scope.Benchmark)\npublic class MyBenchmark {\n\n  @Param(value = { \"10\", \"50\", \"100\" })\n  private int length;\n\n  @Benchmark\n  public void testStringAdd(Blackhole blackhole) {\n    String a = \"\";\n    for (int i = 0; i \u003c length; i++) {\n      a += i;\n    }\n    blackhole.consume(a);\n  }\n\n  @Benchmark\n  public void testStringBuilderAdd(Blackhole blackhole) {\n    StringBuilder sb = new StringBuilder();\n    for (int i = 0; i \u003c length; i++) {\n      sb.append(i);\n    }\n    blackhole.consume(sb.toString());\n  }\n\n  public static void main(String[] args) throws RunnerException {\n    Options opt = new OptionsBuilder()\n        .include(MyBenchmark.class.getSimpleName())\n        .result(\"result.json\")\n        .resultFormat(ResultFormatType.JSON).build();\n\n    new Runner(opt).run();\n  }\n}\n```\n进入[可视化页面](http://deepoove.com/jmh-visual-chart/)，上传JMH的JSON格式结果文件result.json([下载result.json示例文件](http://deepoove.com/jmh-visual-chart/result.json))进行图表渲染：\n\n![](./JMH-Horizontal.png)\n\n支持切换横向视图和垂直视图。\n\n![](./JMH-Vertical.png)\n\n页面URL后加上参数[?theme=default](http://deepoove.com/jmh-visual-chart/?theme=default)会切换成白色主题。\n\n![](./JMH-theme.png)\n\n图表的右上角支持PNG格式图片的下载。\n\n### Why JMH-Visual-chart\n[http://jmh.morethan.io/](http://jmh.morethan.io/)是一个非常棒的JMH可视化的页面，提供了「不同方法一组参数维度」的度量。\n\nJMH-Visual-chart尚处于实验性质，我花了几个小时实现了「一组参数不同方法维度」的度量，并且支持一些额外的功能(主题、PNG下载等)。\n\n当有需要的时候，我会回来扩展更多 **维度** 和更多 **样式** 的图表。\n\n### JMH\n[《JMH基准测试和JMH-Visual-chart可视化》](https://github.com/Sayi/sayi.github.com/issues/68)\n\n[OpenJDK Code Tools: jmh](http://openjdk.java.net/projects/code-tools/jmh/)\n\n[Java Microbenchmark Harness Tutorials](http://tutorials.jenkov.com/java-performance/jmh.html)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayi%2Fjmh-visual-chart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayi%2Fjmh-visual-chart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayi%2Fjmh-visual-chart/lists"}