{"id":3804,"date":"2022-02-17T10:11:03","date_gmt":"2022-02-17T10:11:03","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/ways-to-increase-your-rails-performance\/"},"modified":"2024-07-04T21:01:27","modified_gmt":"2024-07-04T21:01:27","slug":"adferdir-til-ad-auka-afkost-rails","status":"publish","type":"post","link":"https:\/\/thecodest.co\/is\/blog\/ways-to-increase-your-rails-performance\/","title":{"rendered":"Hvernig auka m\u00e1 afk\u00f6st Rails"},"content":{"rendered":"<h2 class=\"wp-block-heading\"><strong>R\u00fab\u00edn fyrst<\/strong><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/thecodest.co\/is\/case-studies\/providing-a-team-of-ruby-developers-for-a-fintech-company\/\">R\u00fab\u00edn<\/a><\/strong> er mj\u00f6g hlutbundi\u00f0 forritunarm\u00e1l. Reyndar er (n\u00e6stum) allt \u00ed <strong>R\u00fab\u00edn<\/strong> er hlutur. A\u00f0 b\u00faa til \u00f3\u00fearfa hluti getur kosta\u00f0 forriti\u00f0 \u00feitt mikla auka minnisnotkun, svo \u00fe\u00fa \u00e6ttir a\u00f0 for\u00f0ast \u00fea\u00f0.<\/p>\n\n\n\n<p>Til a\u00f0 m\u00e6la muninn munum vi\u00f0 nota a <em><a href=\"https:\/\/github.com\/SamSaffron\/memory_profiler\">minnisgreiningart\u00f3l<\/a><\/em> g\u00f6ngusteinn og innbygg\u00f0ur Benchmark-mod\u00fal til a\u00f0 m\u00e6la t\u00edmaframmist\u00f6\u00f0u.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Nota\u00f0u bang! a\u00f0fer\u00f0ir \u00e1 strengjum<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require \"memory_profiler\"\n\nreport = MemoryProfiler.report do\n<a href=\"https:\/\/thecodest.co\/is\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">g\u00f6gn<\/a> = \"X\" * 1024 * 1024 * 100\ndata = data.downcase\nend\n\nreport.pretty_print<\/code><\/pre>\n\n\n\n<p>\u00cd listanum h\u00e9r a\u00f0 ne\u00f0an bjuggum vi\u00f0 til 100 MB streng og breyttum \u00f6llum st\u00f6fum \u00ed hann \u00ed l\u00e1gst\u00f6fur. Vi\u00f0mi\u00f0unartak okkar s\u00fdnir <a href=\"https:\/\/thecodest.co\/is\/blog\/why-us-companies-are-opting-for-polish-developers\/\">okkur<\/a> eftirfarandi sk\u00fdrsla:<\/p>\n\n\n\n<p><em>Heildar\u00fathluta\u00f0: 210765044 b\u00e6ti (6 hlutir)<\/em><\/p>\n\n\n\n<p>Hins vegar, ef vi\u00f0 skiptum l\u00ednu 6 \u00fat fyrir:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">G\u00f6gnin eru skr\u00e1\u00f0 \u00ed l\u00e1gst\u00f6fum!<\/code>Hlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p><code> <\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Lesi\u00f0 skr\u00e1r l\u00ednu fyrir l\u00ednu<\/strong><\/h2>\n\n\n\n<p>Sagt er a\u00f0 vi\u00f0 \u00feurfum a\u00f0 s\u00e6kja gr\u00ed\u00f0arlega gagnasafni\u00f0 sem inniheldur 2 millj\u00f3n f\u00e6rslur \u00far CSV-skr\u00e1. Venjulega l\u00edtur \u00fea\u00f0 svona \u00fat:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require 'benchmark'\n\nBenchmark.bm do |x|\nx.report do\nFile.readlines(\"2mrecords.csv\").map! {|line| line.split(\",\")}\nend\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">notandi kerfi samtals raunverulegt\n\n12.797000   2.437000  15.234000 (106.319865)<\/code><\/pre>\n\n\n\n<p>\u00dea\u00f0 t\u00f3k okkur meira en 106 sek\u00fandur a\u00f0 hla\u00f0a skr\u00e1nni ni\u00f0ur a\u00f0 fullu. Talsvert miki\u00f0! En vi\u00f0 getum fl\u00fdtt fyrir \u00feessu ferli me\u00f0 \u00fev\u00ed a\u00f0 skipta \u00fat <em>kort!<\/em> a\u00f0fer\u00f0 me\u00f0 einf\u00f6ldu <em>\u00e1 me\u00f0an<\/em> hringr\u00e1s:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require 'benchmark'\n\nBenchmark.bm do |x|\nx.report do\nfile = File.open(\"2mrecords.csv\", \"r\")\nwhile line = file.gets\nline.split(\",\")\nend\nend\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">notandi kerfi samtals raunverulegt\n\n6.078000   0.250000   6.328000 (  6.649422)<\/code><\/pre>\n\n\n\n<p>Keyrslut\u00edminn hefur n\u00fa dregist verulega saman s\u00ed\u00f0an <em>kort!<\/em> a\u00f0fer\u00f0 tilheyrir \u00e1kve\u00f0num flokki, eins og <em>Hash#map<\/em> e\u00f0a <em>Array#map<\/em>, \u00fear sem <strong>R\u00fab\u00edn<\/strong> mun geyma hverja l\u00ednu af greindu skr\u00e1nni \u00ed minni me\u00f0an \u00e1 framkv\u00e6md stendur. <strong>Ruslat\u00f6kuma\u00f0ur Ruby <\/strong>mun ekki losa minni\u00f0 fyrr en \u00feessir endurteknarar hafa veri\u00f0 fullkomlega framkv\u00e6mdir. Hins vegar mun l\u00ednufyrir l\u00ednu lestur kalla \u00e1 ruslhreinsun (GC) til a\u00f0 f\u00e6ra minni\u00f0 \u00far fyrri l\u00ednum \u00feegar \u00fea\u00f0 er ekki nau\u00f0synlegt.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>For\u00f0astu a\u00f0fer\u00f0artilv\u00edsanir \u00e1 st\u00e6rri safnum<\/strong><\/h2>\n\n\n\n<p>\u00deetta er framlenging \u00e1 fyrri atri\u00f0inu me\u00f0 algengara d\u00e6mi. Eins og \u00e9g nefndi, <a href=\"https:\/\/thecodest.co\/blog\/high-demand-for-ruby-developers\/\">R\u00fab\u00edn<\/a> \u00cdteratorar eru a\u00f0fer\u00f0ir hluta og losa ekki minni me\u00f0an \u00e1 \u00feeim stendur. \u00c1 sm\u00e1um skala er munurinn merkingarlaus (og a\u00f0fer\u00f0ir eins og <em>kort<\/em> (vir\u00f0ist l\u00e6silegra). Hins vegar, \u00feegar um st\u00e6rri gagnas\u00f6fn er a\u00f0 r\u00e6\u00f0a, er alltaf g\u00f3\u00f0 hugmynd a\u00f0 \u00edhuga a\u00f0 skipta \u00fev\u00ed \u00fat fyrir einfaldari lykkjur. Eins og \u00ed d\u00e6minu h\u00e9r a\u00f0 ne\u00f0an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">numberofelements = 10000000\nrandoms = Array.new(numberofelements) { rand(10) }\n\nrandoms.each do |line|\n#do something\nend<\/code><\/pre>\n\n\n\n<p>og eftir endurskipulagningu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">numberofelements = 10000000\nrandoms = Array.new(numberofelements) { rand(10) }\n\nwhile randoms.count &gt; 0\nline = randoms.shift\n#do something\nend\n\u201c`<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Nota\u00f0u String::&lt;&lt; a\u00f0fer\u00f0ina.<\/strong><\/h2>\n\n\n\n<p>\u00deetta er flj\u00f3tleg en s\u00e9rstaklega gagnleg r\u00e1\u00f0. Ef \u00fe\u00fa b\u00e6tir einum streng vi\u00f0 annan me\u00f0 += rekstrarmerkinu, fer \u00fea\u00f0 fram bak vi\u00f0 tj\u00f6ldin. <strong>R\u00fab\u00edn <\/strong> mun b\u00faa til auka hlut. Svo, \u00feetta:\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">a = \"X\"\n b = \"Y\"\n a += b<\/code>Hlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>\u00de\u00fd\u00f0ir \u00ed raun \u00feetta:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">a = \"X\"\n b = \"Y\"\n c = a + b\n a = c<\/code>Hlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>Rekandinn myndi for\u00f0ast \u00fea\u00f0, sem sparar \u00fe\u00e9r minni:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">a = \"X\"\n b = \"Y\"\n a &lt;&lt; b<\/code>Hlj\u00f3\u00f0skriftHlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>T\u00f6lum um Rails<\/strong><\/h2>\n\n\n\n<p>\u00deeir <strong>Rails-rammi <\/strong> er me\u00f0 gn\u00e6g\u00f0 af \u201c<em>gildrur<\/em>\u201dsem myndi gera \u00fe\u00e9r kleift a\u00f0 h\u00e1marka \u00feitt <a href=\"https:\/\/thecodest.co\/is\/dictionary\/what-is-code-refactoring\/\">k\u00f3\u00f0i<\/a> hratt og \u00e1n of mikillar vi\u00f0b\u00f3tar fyrirhafnar.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Fur\u00f0u\u00e1lagning (einnig kalla\u00f0 n+1-fyrirspurnavandam\u00e1l)<\/strong><\/h2>\n\n\n\n<p>Gerum r\u00e1\u00f0 fyrir a\u00f0 vi\u00f0 h\u00f6fum tv\u00f6 tengd m\u00f3del, Post og Author:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">class Author &lt; ApplicationRecord\nhas_many :posts\nend\n\nclass Post &lt; ApplicationRecord\nbelongs_to :author\nend<\/code><\/pre>\n\n\n\n<p>Vi\u00f0 viljum s\u00e6kja allar f\u00e6rslurnar \u00ed st\u00fdrit\u00e6kinu okkar og birta \u00fe\u00e6r \u00ed s\u00fdn me\u00f0 h\u00f6fundum \u00feeirra:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">st\u00fdrit\u00e6ki\n\ndef index\n@posts = Post.all.limit(20)\nend\n\ns\u00fdn<\/code><\/pre>\n\n\n\n<p>\u00cd st\u00fdrit\u00e6kinu, <a href=\"https:\/\/thecodest.co\/blog\/a-simple-ruby-application-from-scratch-with-active-record\/\">Virkur skr\u00e1<\/a> mun \u00fea\u00f0 b\u00faa til a\u00f0eins eina fyrirspurn til a\u00f0 finna f\u00e6rslurnar okkar. En s\u00ed\u00f0ar mun \u00fea\u00f0 einnig kalla \u00e1 20 a\u00f0rar fyrirspurnir til a\u00f0 finna hvern h\u00f6fund fyrir sig \u2013 sem tekur aukat\u00edma! Sem betur fer fylgir Rails flj\u00f3tlegri lausn til a\u00f0 sameina \u00feessar fyrirspurnir \u00ed eina. Me\u00f0 \u00fev\u00ed a\u00f0 nota <em>innifelur<\/em> Me\u00f0 \u00feessari a\u00f0fer\u00f0 getum vi\u00f0 endurskrifa\u00f0 st\u00fdrit\u00e6ki\u00f0 okkar svona:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code> def index\n @posts = Post.all.includes(:author).limit(20)\n end<\/code>Hlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>Fyrir n\u00fa er a\u00f0eins nau\u00f0synlegum g\u00f6gnum s\u00f3tt \u00ed eina fyrirspurn.\u00a0<\/p>\n\n\n\n<p>\u00de\u00fa getur einnig nota\u00f0 a\u00f0ra gimsteina, svo sem <a href=\"https:\/\/github.com\/flyerhzm\/bullet\">k\u00fala<\/a> a\u00f0 s\u00e9rsn\u00ed\u00f0a allt ferli\u00f0.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Hringdu a\u00f0eins \u00ed \u00fea\u00f0 sem \u00fe\u00fa \u00fearft<\/strong><\/h2>\n\n\n\n<p>\u00d6nnur gagnleg a\u00f0fer\u00f0 til a\u00f0 auka hra\u00f0a ActiveRecord er a\u00f0 kalla eing\u00f6ngu \u00e1 \u00feau eiginleika sem nau\u00f0synlegir eru fyrir n\u00faverandi notkun. \u00deetta er s\u00e9rstaklega gagnlegt \u00feegar forriti\u00f0 \u00feitt fer a\u00f0 vaxa og fj\u00f6ldi d\u00e1lka \u00ed hverri t\u00f6flu eykst einnig.<\/p>\n\n\n\n<p>T\u00f6kum fyrri k\u00f3\u00f0ann okkar sem d\u00e6mi og gerum r\u00e1\u00f0 fyrir a\u00f0 vi\u00f0 \u00feurfum a\u00f0eins a\u00f0 velja n\u00f6fn \u00far h\u00f6fundum. Svo getum vi\u00f0 endurskrifa\u00f0 st\u00fdringuna okkar:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">def index\n @posts = Post.all.includes(:author).select(\"name\").limit(20)\n end<\/code>Hlj\u00f3\u00f0skriftHlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>N\u00fa skipum vi\u00f0 st\u00fdrit\u00e6kinu okkar a\u00f0 sleppa \u00f6llum eiginleikum nema \u00feeim einum sem vi\u00f0 \u00feurfum.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Birta hluta r\u00e9tt<\/strong><\/h2>\n\n\n\n<p>Segjum a\u00f0 vi\u00f0 viljum b\u00faa til a\u00f0skilda hlutastykki fyrir f\u00e6rslurnar okkar \u00far fyrri d\u00e6mum:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">@posts.each do |post|\n  \n end\n<\/code>Hlj\u00f3\u00f0skriftHlj\u00f3\u00f0skriftHlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>Vi\u00f0 fyrstu s\u00fdn vir\u00f0ist \u00feessi k\u00f3\u00f0i vera r\u00e9ttur. Hins vegar, \u00feegar fleiri f\u00e6rslur \u00fearf a\u00f0 birta, ver\u00f0ur allt ferli\u00f0 verulega h\u00e6gara. \u00deetta er vegna \u00feess a\u00f0 <strong>Relsar <\/strong> kallar \u00e1 hlutdr\u00e6gni okkar me\u00f0 n\u00fdrri endurtekningu enn og aftur. Vi\u00f0 getum laga\u00f0 \u00fea\u00f0 me\u00f0 \u00fev\u00ed a\u00f0 nota <em>Safnanir<\/em> eiginleiki:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">Rendera @posts<\/code>Hlj\u00f3\u00f0skriftHlj\u00f3\u00f0skriftHlj\u00f3\u00f0skrift<\/pre>\n\n\n\n<p>N\u00fana, <strong>Relsar<\/strong> mun sj\u00e1lfkrafa \u00e1kvar\u00f0a hva\u00f0a sni\u00f0m\u00e1t eigi a\u00f0 nota og frumstilla \u00fea\u00f0 a\u00f0eins einu sinni.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Nota\u00f0u bakgrunnsvinnslu<\/strong><\/h2>\n\n\n\n<p>\u00d6ll ferli sem eru t\u00edmafrek en ekki nau\u00f0synleg fyrir n\u00faverandi vinnufl\u00e6\u00f0i \u00feitt g\u00e6tu talist g\u00f3\u00f0ir kostir fyrir bakgrunnsvinnslu, t.d. sending t\u00f6lvup\u00f3sta, s\u00f6fnun t\u00f6lfr\u00e6\u00f0iuppl\u00fdsinga e\u00f0a \u00fatg\u00e1fa reglubundinna sk\u00fdrslna.&nbsp;<\/p>\n\n\n\n<p><strong>Sa\u00eddk\u00edk<\/strong> er algengasta gimsteinninn sem nota\u00f0ur er fyrir bakgrunnsvinnslu. Hann notar <strong>Redis<\/strong> til a\u00f0 geyma verkefni. \u00dea\u00f0 gerir \u00fe\u00e9r einnig kleift a\u00f0 stj\u00f3rna fl\u00e6\u00f0i bakgrunnsferla \u00feinna, skipta \u00feeim \u00ed a\u00f0skildar bi\u00f0ra\u00f0ir og st\u00fdra minnisnotkun hvers og eins \u00feeirra.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Rita\u00f0u minna k\u00f3\u00f0a, nota\u00f0u fleiri gems<\/strong><\/h2>\n\n\n\n<p><strong>Relsar <\/strong> koma me\u00f0 gr\u00ed\u00f0arlegt magn af gimsteinum sem ekki a\u00f0eins gera l\u00edf \u00feitt au\u00f0veldara og fl\u00fdta fyrir <a href=\"https:\/\/thecodest.co\/is\/blog\/how-the-codests-team-extension-model-can-transform-your-in-house-development-team\/\">\u00fer\u00f3unarferli<\/a>, en einnig auka afk\u00f6st og hra\u00f0a forritsins \u00fe\u00edns. Perlur eins og Devise e\u00f0a Pundit eru yfirleitt vel pr\u00f3fa\u00f0ar hva\u00f0 var\u00f0ar hra\u00f0a og virka hra\u00f0ar og \u00f6ruggar en s\u00e9rskrifa\u00f0ur k\u00f3\u00f0i fyrir sama tilgang.<\/p>\n\n\n\n<p>Ef einhverjar spurningar koma upp um b\u00e6tt <em>Frammista\u00f0a Rails<\/em>, n\u00e1 <strong><a href=\"https:\/\/thecodest.co\">The Codest verkfr\u00e6\u00f0ingar<\/a><\/strong> \u00dat til a\u00f0 r\u00e1\u00f0f\u00e6ra \u00feig um vafa \u00fe\u00edna.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/careers#offers]\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/ruby-1-.png\" alt=\"Tilbo\u00f0 fyrir Ruby-\u00fer\u00f3unara\u00f0ila\"\/><\/a><\/figure>\n\n\n\n<p><strong>Lesa meira:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/pros-and-cons-of-ruby-software-development\/\">Kostir og gallar vi\u00f0 forritunar\u00fer\u00f3un \u00ed Ruby<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-and-other-means-of-transport\">Lestar og \u00f6nnur samg\u00f6ngut\u00e6ki<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-development-with-tmux-vim-fzf-ripgrep\">Rails-\u00fer\u00f3un me\u00f0 tmux, vim, fzf og ripgrep<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u00der\u00e1tt fyrir fj\u00f6lmarga kosti er Ruby on Rails enn talinn tilt\u00f6lulega h\u00e6gur vefgrind. Vi\u00f0 vitum \u00f6ll a\u00f0 Twitter hefur yfirgefi\u00f0 Rails til a\u00f0 nota Scala. Hins vegar, me\u00f0 nokkrum snj\u00f6llum umb\u00f3tum getur\u00f0u keyrt forriti\u00f0 \u00feitt mun hra\u00f0ar!<\/p>","protected":false},"author":2,"featured_media":3805,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3804","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Increase Rails Performance - The Codest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/is\/blogg\/adferdir-til-ad-auka-afkost-rails\/\" \/>\n<meta property=\"og:locale\" content=\"is_IS\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Increase Rails Performance\" \/>\n<meta property=\"og:description\" content=\"Despite its numerous advantages, Ruby on Rails is still considered to be a relatively slow web framework. We all know that Twitter has left Rails in favor of Scala. However, with a few cleaver improvements you can run your app significantly faster!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/is\/blogg\/adferdir-til-ad-auka-afkost-rails\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-17T10:11:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-04T21:01:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"How to Increase Rails Performance\",\"datePublished\":\"2022-02-17T10:11:03+00:00\",\"dateModified\":\"2024-07-04T21:01:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"},\"wordCount\":856,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"is\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\",\"name\":\"How to Increase Rails Performance - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"datePublished\":\"2022-02-17T10:11:03+00:00\",\"dateModified\":\"2024-07-04T21:01:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#breadcrumb\"},\"inLanguage\":\"is\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"is\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Increase Rails Performance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"is\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"is\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"is\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/is\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Hvernig auka m\u00e1 afk\u00f6st Rails - The Codest","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/is\/blogg\/adferdir-til-ad-auka-afkost-rails\/","og_locale":"is_IS","og_type":"article","og_title":"How to Increase Rails Performance","og_description":"Despite its numerous advantages, Ruby on Rails is still considered to be a relatively slow web framework. We all know that Twitter has left Rails in favor of Scala. However, with a few cleaver improvements you can run your app significantly faster!","og_url":"https:\/\/thecodest.co\/is\/blogg\/adferdir-til-ad-auka-afkost-rails\/","og_site_name":"The Codest","article_published_time":"2022-02-17T10:11:03+00:00","article_modified_time":"2024-07-04T21:01:27+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"How to Increase Rails Performance","datePublished":"2022-02-17T10:11:03+00:00","dateModified":"2024-07-04T21:01:27+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"},"wordCount":856,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","articleSection":["Software Development"],"inLanguage":"is","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/","url":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/","name":"Hvernig auka m\u00e1 afk\u00f6st Rails - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","datePublished":"2022-02-17T10:11:03+00:00","dateModified":"2024-07-04T21:01:27+00:00","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#breadcrumb"},"inLanguage":"is","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"]}]},{"@type":"ImageObject","inLanguage":"is","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"How to Increase Rails Performance"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"is"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"is","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"is","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/is\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/posts\/3804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/comments?post=3804"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/posts\/3804\/revisions"}],"predecessor-version":[{"id":8428,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/posts\/3804\/revisions\/8428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/media\/3805"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/media?parent=3804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/categories?post=3804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/tags?post=3804"}],"curies":[{"name":"vp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}