{"id":5,"date":"2024-08-02T02:53:02","date_gmt":"2024-08-02T02:53:02","guid":{"rendered":"https:\/\/samobembe.com\/?p=5"},"modified":"2025-08-08T14:13:31","modified_gmt":"2025-08-08T14:13:31","slug":"comparing-go-and-c","status":"publish","type":"post","link":"https:\/\/samobembe.com\/?p=5","title":{"rendered":"Comparing Go and C#"},"content":{"rendered":"\n<p>Last year, I decided to dabble with Go, the programming language, not the board game. As much as people hyped it up as being simple and elegant, I was not exactly fond of the syntax. Certain things threw me off like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Types after method arguments\n<ul class=\"wp-block-list\">\n<li><code>func sayHi(name string){<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Variable declaration using \u201c:\u201d\n<ul class=\"wp-block-list\">\n<li><code>name := \"sam\"<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Pointers<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>Eventually, I was able to wrap my head around it and made a basic web API. The API had one endpoint that accepted a URL for an Rss feed, fetched the feed, cached it in memory and returned it in a response. I was dabbling with making an Rss reader app with Ionic, when I ran into CORS errors with some sites. This Rss Proxy API was set up to be a way around that.<\/p>\n\n\n\n<p>I implemented the API twice. First time in Go and second time in C#\/Asp.net core. They both performed well, however there was a noticeable difference when I tried to containerize them.<\/p>\n\n\n\n<p>The Go image (22.6MB) was under 1\/10th of the size of the Dotnet image(358.51mb). The Go image could have been smaller but I added a Swagger User Interface, to mimic the functionality that Dotnet provides out of the box. Its resting memory utilization was also much smaller than Dotnet, with the Go container using 6% of RAM while the Dotnet container used 18% or RAM.<\/p>\n\n\n\n<p>There are probably some ways to optimize the Dotnet image. I tried using <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/core\/whats-new\/dotnet-8\/containers#chiseled-ubuntu-images\">chiseled containers<\/a> , but ran into issues getting it to work. With time I imagine the difference in image size between Dotnet and Go APIs would decrease.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Repositories<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/sam-obembe\/rssProxy\">Rss Proxy, GO<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/sam-obembe\/RssProxyDotnet\">Rss Proxy, Dotnet<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rss Proxy (Go)<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"480\" src=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-1024x480.png\" alt=\"\" class=\"wp-image-18\" srcset=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-1024x480.png 1024w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-300x141.png 300w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-768x360.png 768w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-1536x720.png 1536w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDigitalOcean-2048x959.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"813\" src=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage-1024x813.png\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage-1024x813.png 1024w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage-300x238.png 300w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage-768x609.png 768w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage-1536x1219.png 1536w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyGoDockerImage.png 1918w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rss Proxy (Dotnet)<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"540\" src=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-1024x540.png\" alt=\"\" class=\"wp-image-20\" srcset=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-1024x540.png 1024w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-300x158.png 300w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-768x405.png 768w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-1536x809.png 1536w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDigitalOcean-2048x1079.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"700\" src=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage-1024x700.png\" alt=\"\" class=\"wp-image-21\" srcset=\"https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage-1024x700.png 1024w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage-300x205.png 300w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage-768x525.png 768w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage-1536x1050.png 1536w, https:\/\/samobembe.com\/wp-content\/uploads\/2024\/08\/RssProxyDotnetDockerImage.png 2034w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Last year, I decided to dabble with Go, the programming language, not the board game. As much as people hyped it up as being simple and elegant, I was not exactly fond of the syntax. Certain things threw me off like: Eventually, I was able to wrap my head around it and made a basic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samobembe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5"}],"version-history":[{"count":5,"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":55,"href":"https:\/\/samobembe.com\/index.php?rest_route=\/wp\/v2\/posts\/5\/revisions\/55"}],"wp:attachment":[{"href":"https:\/\/samobembe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/samobembe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/samobembe.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}