{"id":551,"date":"2024-12-20T18:31:36","date_gmt":"2024-12-20T09:31:36","guid":{"rendered":"https:\/\/www.b64.pw\/blog\/?p=551"},"modified":"2024-12-20T18:31:37","modified_gmt":"2024-12-20T09:31:37","slug":"dotnet-sdk%e3%81%aeaot%e3%82%92%e6%af%94%e8%bc%83%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/www.b64.pw\/blog\/?p=551","title":{"rendered":"DotNET SDK\u306eAOT\u3092\u6bd4\u8f03\u3057\u3066\u307f\u305f"},"content":{"rendered":"\n<h2>\u304d\u3063\u304b\u3051<\/h2>\n\n\n\n<p>STS\u3060\u3051\u308c\u3069\u3082DotNET9\u3082\u3067\u305f\u3053\u3068\u3067\u3059\u3057\u3001Mac\u3067\u3082AOT\u30d3\u30eb\u30c9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f(ver8)\u3068\u6c17\u306b\u306a\u308b\u611f\u3058\u304c\u81ea\u5206\u7684\u306b\u305f\u304b\u307e\u3063\u3066\u304d\u305f\u306e\u3067\u8efd\u304f\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u4e3b\u306b<\/p>\n\n\n\n<ul><li>\u30d3\u30eb\u30c9\u30b5\u30a4\u30ba<\/li><li>\u5b9f\u884c\u901f\u5ea6<\/li><li>\u8d77\u52d5\u901f\u5ea6<\/li><\/ul>\n\n\n\n<p>\u306b\u7d5e\u3063\u3066\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2>\u6e96\u5099<\/h2>\n\n\n\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u8a2d\u5b9a\u3067\u5404\u30d0\u30fc\u30b8\u30e7\u30f3SDK\u3092\u6307\u5b9a\u3057\u3066\u30d3\u30eb\u30c9\u3057\u3066\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u3001<\/p>\n\n\n\n<p>\u5f71\u97ff\u3092\u5207\u308a\u5206\u3051\u308b\u305f\u3081\u306basdf\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5358\u4f4d\u3067\u7570\u306a\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u306eSDK\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u691c\u8a3c\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u306b\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew install asdf\r\n\r\nasdf install dotnet 6.0.428\r\nasdf install dotnet 7.0.410\r\nasdf install dotnet 8.0.404\r\nasdf install dotnet 9.0.101\r\n\r\ncd dotnet6\r\nasdf local dotnet 6.0.428\r\ncd - \r\n\r\ncd dotnet7\r\nasdf local dotnet 7.0.410\r\ncd -\r\n\r\ncd dotnet8\r\nasdf local dotnet 8.0.403\r\ncd -\r\n\r\ncd dotnet9\r\nasdf local dotnet 9.0.101\r\ncd -<\/code><\/pre>\n\n\n\n<h2>\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u5b9f\u65bd<\/h2>\n\n\n\n<p>\u307e\u305a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3054\u3068\u306b.proj\u30d5\u30a1\u30a4\u30eb\u306b\u30d3\u30eb\u30c9\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u3001\u305d\u3053\u306b\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u3066<\/p>\n\n\n\n<p>build&amp;publish\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3072\u3068\u307e\u305a\u4eca\u56de\u306f\u8ca0\u8377\u304c\u8abf\u7bc0\u3057\u3084\u3059\u3044\u6700\u9069\u5316\u3057\u306a\u3044\u611f\u3058\u306e\u7d20\u6570\u3092\u3082\u3068\u3081\u308b\u30b3\u30fc\u30c9\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u30d3\u30eb\u30c9\u5f8c\u306b\u305d\u308c\u305e\u308c\u306e\u30d0\u30a4\u30ca\u30ea\u306e\u30b5\u30a4\u30ba\u3092\u78ba\u8a8d\u3057\u305f\u306e\u3061\u3001\u8d77\u52d5\u6642\u9593\u3082\u6e2c\u308a\u305f\u3044\u305f\u3081time\u30b3\u30de\u30f3\u30c9\u3067\u8a08\u6e2c\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u306b\u306f\u3053\u306e\u3088\u3046\u306arun_bench.sh\u3092\u4f5c\u6210\u3057\u3066\u3001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/bin\/bash -eu\r\n\nwc -c dotnet6\/bin\/Release\/net6.0\/osx-arm64\/publish\/prime_num \r\nwc -c dotnet7\/bin\/Release\/net7.0\/osx-arm64\/publish\/prime_num\r\nwc -c dotnet8\/bin\/Release\/net8.0\/osx-arm64\/native\/prime_num\r\nwc -c dotnet9\/bin\/Release\/net9.0\/osx-arm64\/native\/prime_num\r\n\r\nMAX_NUM=${MAX_NUM:-1000000}\r\n\r\ntime dotnet6\/bin\/Release\/net6.0\/osx-arm64\/publish\/prime_num $MAX_NUM\r\ntime dotnet7\/bin\/Release\/net7.0\/osx-arm64\/publish\/prime_num $MAX_NUM\r\ntime dotnet8\/bin\/Release\/net8.0\/osx-arm64\/native\/prime_num $MAX_NUM\r\ntime dotnet9\/bin\/Release\/net9.0\/osx-arm64\/native\/prime_num $MAX_NUM<\/code><\/pre>\n\n\n\n<p>\u3053\u3093\u306a\u304b\u3093\u3058\u3067\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/build.sh &amp;&amp;  (.\/run_bench.sh 2>&amp;1) > result_bench.txt<\/code><\/pre>\n\n\n\n<h2>\u7d50\u679c<\/h2>\n\n\n\n<p><strong>\u30b5\u30a4\u30ba<\/strong><\/p>\n\n\n\n<p>\u3084\u306f\u308aAOT\u30aa\u30d7\u30b7\u30e7\u30f3(<a rel=\"noreferrer noopener\" href=\"https:\/\/learn.microsoft.com\/ja-jp\/dotnet\/core\/deploying\/native-aot\/?tabs=macOS%2Cnet8\" target=\"_blank\">PublishAot<\/a>)\u304c\u4f7f\u3048\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u304b\u3089\u3050\u3063\u3068\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3068\u304f\u306bver9\u306f\u30b5\u30a4\u30ba\u304c\u7d0412%\u306b\u306a\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30b3\u30fc\u30c9\u304c\u5c11\u306a\u3044\u6761\u4ef6\u306e\u305b\u3044\u304b\u3084\u306f\u308a\u5927\u304d\u306a\u5dee\u304c\u3067\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u3053\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u30b5\u30a4\u30ba\u78ba\u8a8d wc -c dotnet6\/bin\/Release\/net6.0\/osx-arm64\/publish\/prime_num\n\n\n 12224608 dotnet6\/bin\/Release\/net6.0\/osx-arm64\/publish\/prime_num\r\n 12327952 dotnet7\/bin\/Release\/net7.0\/osx-arm64\/publish\/prime_num\r\n 2831864 dotnet8\/bin\/Release\/net8.0\/osx-arm64\/native\/prime_num\r\n 1417416 dotnet9\/bin\/Release\/net9.0\/osx-arm64\/native\/prime_num<\/code><\/pre>\n\n\n\n<p>\u5b9f<strong>\u884c\u901f\u5ea6<\/strong><\/p>\n\n\n\n<p>\u4e88\u60f3\u306b\u53cd\u3057\u3066\u3080\u3057\u308dver6\u304c\u82e5\u5e72\u901f\u3044\u3068\u3044\u3046\u7d50\u679c\u306b\u3002<\/p>\n\n\n\n<p>\u3082\u3057\u304b\u3057\u305f\u3089LinQ\u306a\u3069\u306e\u307b\u304b\u306e\u6a5f\u80fd\u3082\u4f7f\u3063\u305f\u3089\u5927\u304d\u304f\u7570\u306a\u308b\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 1000000\u307e\u3067\u306e\u7d20\u6570\u306e\u500b\u6570\u3092\u8abf\u3079\u7d42\u308f\u308b\u307e\u3067\u306b\u304b\u304b\u3063\u305f\u6642\u9593\n\ndotnet6 24.079s\ndotnet7 27.814s\ndotnet8 27.562s\ndotnet9 31.736s<\/code><\/pre>\n\n\n\n<p><strong>\u8d77\u52d5\u901f\u5ea6<\/strong><\/p>\n\n\n\n<p>\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u3092\u3059\u3050\u7d42\u308f\u308b\u8a2d\u5b9a\u3067\u5b9f\u884c\u3057\u3066\u6bd4\u8f03\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u3084\u306f\u308aAOT\u304c\u4f7f\u3048\u308bver8\u30849\u304c\u3084\u306f\u308a\u6709\u5229\u3002<\/p>\n\n\n\n<p>AOT\u306a\u3057\u306e\u9803\u306b\u6bd4\u307912%\u7a0b\u5ea6\u306b\u8d77\u52d5\u6642\u9593\u304c\u77ed\u7e2e\u3057\u3066\u3044\u308b\u3082\u3088\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 10\u307e\u3067\u306e\u7d20\u6570\u306e\u500b\u6570\u3092\u8abf\u3079\u7d42\u308f\u308b\u307e\u3067\u306b\u304b\u304b\u3063\u305f\u6642\u9593\n\ndotnet6 0.092s\ndotnet7 0.110s\ndotnet8 0.016s\ndotnet9 0.014s<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2><strong>\u4f7f\u3063\u305f\u30b3\u30fc\u30c9<\/strong><\/h2>\n\n\n\n<p>\u30d3\u30eb\u30c9\u8a2d\u5b9a\u306a\u3069\u3082\u542b\u3081\u3066 <a href=\"https:\/\/github.com\/pg-ito\/dotnet_bench_comparison\" target=\"_blank\" rel=\"noreferrer noopener\">\u3053\u3061\u3089<\/a> \u306bUP\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304d\u3063\u304b\u3051 STS\u3060\u3051\u308c\u3069\u3082DotNET9\u3082\u3067\u305f\u3053\u3068\u3067\u3059\u3057\u3001M &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44,16],"tags":[],"_links":{"self":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/551"}],"collection":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=551"}],"version-history":[{"count":1,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/551\/revisions"}],"predecessor-version":[{"id":552,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/551\/revisions\/552"}],"wp:attachment":[{"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.b64.pw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}