{"id":23643,"date":"2019-01-12T12:25:10","date_gmt":"2019-01-12T12:25:10","guid":{"rendered":"https:\/\/stackify.com\/?p=23643"},"modified":"2024-04-19T05:39:25","modified_gmt":"2024-04-19T05:39:25","slug":"ruby-performance-tuning","status":"publish","type":"post","link":"https:\/\/stackify.com\/ruby-performance-tuning\/","title":{"rendered":"Ruby Performance Tuning"},"content":{"rendered":"<p>There are many things to praise about the Ruby language: adherence to the object orientation paradigm, simplicity, elegance, and powerful meta-programming capabilities. Unfortunately, performance isn\u2019t top of mind when people think about the many qualities of the language.<\/p>\n<p>For years, people have been denouncing the Ruby programming language as slow. Is it? Sure, some people will spread a fair amount of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fear,_uncertainty_and_doubt\" target=\"_blank\" rel=\"noopener noreferrer\">FUD<\/a> around. That\u2019s the tech industry. But there\u2019s no denying that, at least in its main implementations, performance isn\u2019t the area where Ruby shines the most.<\/p>\n<p>In today\u2019s post, we will cover explanations for Ruby performance issues. Then we\u2019ll cover practical tips on what to do to improve the performance of your Ruby apps. Let\u2019s get started!<\/p>\n<h3><a id=\"post-23643-_cv7wszvwjf9u\"><\/a>What can make Ruby code slow?<\/h3>\n<h2><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-23644\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/word-image-2.png\" alt=\"image-turtle\" width=\"741\" height=\"513\" \/><\/h2>\n<p>Ruby performance is sometimes slow, and since we\u2019re not happy with that, we must learn how to speed it up. To do that, we have to understand the causes of Ruby&#8217;s slowness. And that\u2019s what we will do in this section.<\/p>\n<p>Ruby has a high memory consumption. It\u2019s an inescapable feature of the language that stems from its design. Remember when I said earlier that one of the most often-celebrated aspects of Ruby is its loyalty to the object orientation paradigm? In Ruby, everything (or almost everything) is an object. This characteristic, in the opinion of many people including myself, makes for code that feels more predictable and consistent, causing fewer \u201cwhat the heck\u201d moments for the reader. They often call this \u201cthe principle of least astonishment,\u201d or PLA.<\/p>\n<p>But this characteristic\u00a0is also one cause of poor Ruby performance. Programs need extra memory to represent data\u2014even primitives like integers\u2014as objects.<\/p>\n<p>Finally, Ruby\u2019s GC (<a href=\"https:\/\/stackify.com\/what-is-java-garbage-collection\/\" target=\"_blank\" rel=\"noopener noreferrer\">garbage collector<\/a>) isn\u2019t that great\u2014at least in versions before 2.1. The algorithm for Ruby\u2019s GC is \u201cmark and-sweep,\u201d which is the slowest algorithm for a garbage collector. It also has to stop the application during garbage collection. Double performance penalty!<\/p>\n<h3>Ruby performance tuning: tips to fix common problems<\/h3>\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-23645\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/word-image-3.png\" alt=\"fix-problem\" width=\"1627\" height=\"796\" \/><\/h3>\n<p>Since you\u2019re reading a post called \u201cRuby performance tuning,\u201d I\u2019m sure you\u2019re looking forward to seeing performance tuning tips! That\u2019s what we will see in this section. We\u2019ll cover common Ruby performance problems a developer can face when writing Ruby code and what you can do to solve them\u2014or avoid them altogether.<\/p>\n<h4>Read files line by line<\/h4>\n<p>Reading an entire file\u00a0at once can take a heavy toll on memory. Sure, the larger the file you\u2019re reading, the larger the amount of memory needed; even relatively small files can put a lot of pressure on your program\u2019s performance. And why is that? Simple: more often than not, reading the file is just the first step. After that, you\u2019ll most likely want to perform parsing to extract the data found in the file and do something useful with it. This will inevitably lead to the creation of additional objects, which takes more memory and exerts even more pressure on the GC.<\/p>\n<p>Let\u2019s see a quick example. Consider the following excerpt of code:<\/p>\n<pre class=\"prettyprint\"><code lang=\"ruby\">require 'Date'\ncontent = File.open('dates.txt')\nyears = content.readlines.map {|line|line.split(\"\/\")[2].to_i}\nleap_years = years.count{|y|Date.leap?(y)}\nputs \"The file contains #{leap_years} dates in leap years.\"<\/code><\/pre>\n<p>This is a silly example, but should suffice for our needs. We have this file called \u201cdates.txt,\u201d which contains\u2014you guessed it!\u2014lots of dates.\u00a0And they\u2019re in the \u201cdd\/mm\/yyyy\u201d format, even though this isn\u2019t particularly relevant to the whole performance thing.<\/p>\n<p>The code loads the whole file to memory. Then we use the \u201creadlines\u201d method, which returns all the lines in the file as an array. After that, we map through each line, executing a code block that splits each line using the \u201c\/\u201d character as a separator. Then we retrieve the last part of the result\u2014which refers to the year\u2014and convert it to an integer number.<\/p>\n<p>It assigns the result of all of this to the \u201cyears\u201d variable. Finally, we use the \u201ccount\u201d method to determine how many of the years are leap ones, and we print that information.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-25353 size-full\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/06\/calendar.jpg\" alt=\"\" width=\"1345\" height=\"957\" \/><\/p>\n<p>The code itself is simple, right? But think about it: why do we need to load the whole file in the memory before starting the process? The short answer is \u201cwe don\u2019t.\u201d Since we\u2019re doing the parsing and leap year verification on a line basis, we could\u2014and should\u2014retrieve the lines in the file one by one and then perform the parsing:<\/p>\n<pre class=\"prettyprint\"><code lang=\"ruby\">file = File.open(\"dates.txt\", \"r\")\nwhile line = file.gets\n    year = line.split('\/')[2].to_i\n    if Date.leap? year then\n        leap_years += 1\n    end\nend<\/code><\/pre>\n<p>Even this version still has room for further Ruby performance tuning, but that can be an exercise for the reader.<\/p>\n<h4>Change in place whenever possible<\/h4>\n<p>You already know Ruby, because of its design, allocates more memory. You\u2019ve also learned that Ruby\u2019s GC, particularly in the older versions, isn\u2019t that fast. To overcome this important roadblock to better Ruby performance, we must use strategies to save as much memory as possible.<\/p>\n<p>One strategy at your disposal amounts to changing objects in place. For changing an object, it\u2019s common for Ruby to have methods that come in two versions. One version returns a new object with the desired modification, keeping the original object unchanged. The other version changes the original object, thus avoiding the extra memory allocation. The method that changes the original object usually has the same name as the version that returns, plus an exclamation mark.<\/p>\n<p>Let\u2019s begin by covering strings. In scenarios where you won\u2019t need the original string after the modification, consider using\u00a0the versions that change in place. With strings, you should always be careful when concatenating them. To be honest, this is a common performance tuning tip for many languages, not just Ruby. The most used way of concatenating strings will create new objects in memory, which is what we\u2019re trying to avoid:<\/p>\n<pre class=\"prettyprint\"><code lang=\"ruby\">message = \"I like\"\nmessage += \"Ruby\"<\/code><\/pre>\n<p>In\u00a0 situations like this, favor using the \u201c&lt;&lt;\u201d (append) method instead:<\/p>\n<pre class=\"prettyprint\"><code lang=\"ruby\">message = \"I like\"\nmessage &lt;&lt; \"Ruby\"<\/code><\/pre>\n<p>That way, Ruby won\u2019t create a new string object, and you\u2019ll avoid the extra memory allocation.<\/p>\n<p>Strings aren\u2019t the only objects that present this memory-saving opportunity. Arrays and hashes are also objects that\u00a0you can modify in place. The reasoning here is the same as with strings: change the objects in place for situations where you\u2019ll no longer need the original ones.<\/p>\n<h4>Tune code that deals with iterators<\/h4>\n<p>Ruby iterators can be a source of bad performance because of their intrinsic characteristics. First, the object being iterated won\u2019t be garbage-collected until the\u00a0iterator\u00a0is done. The implications of this can be serious. Imagine you have a big list in memory and you\u2019re iterating over it. The whole list will stay in memory. Have no use for the items already traversed in the list? Too bad. They\u2019ll stay in memory just the same.<\/p>\n<p>Here\u2019s the second important point about iterators: they\u2019re methods. This is so they can create temporary objects. What does that mean? You guessed it. It means more pressure on our friend the garbage collector.<\/p>\n<p>Now we understand how iterators can harm Ruby performance, let\u2019s see tips to counter that problem.<\/p>\n<h5>Free objects in collections while iterating over them<\/h5>\n<p>Suppose you have a large list of a certain object. You iterate over it and use each item in some calculation, discarding the list after you\u2019re done. It would be better to use a while loop and remove elements from the list as soon as they\u2019re processed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-25354 size-full\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/06\/turbo-1.jpg\" alt=\"\" width=\"1657\" height=\"960\" \/><\/p>\n<p>There might be\u00a0negative effects of list modification inside the loop, but you shouldn\u2019t worry about them. GC time savings will outweigh those effects if you process lots of objects, which happens when your list is large and when you load linked data from these objects \u2014 for example, <a href=\"https:\/\/stackify.com\/ruby-on-rails-blogs-youtube-channels\/\" target=\"_blank\" rel=\"noopener noreferrer\">Rails<\/a> associations.<\/p>\n<h5>Avoid using functions that don\u2019t play well with iterators<\/h5>\n<p>When dealing with iterators, algorithmic complexity matters a lot. Each millisecond you can shave off counts. So when using iterators, you can avoid certain methods known to be slow. Instead, search for alternatives that can give you the same result without the performance penalty.<\/p>\n<p>The Date#parse\u00a0method is bad for performance, so avoid it. One solution is to specify the expected date format when parsing. So, suppose you\u2019re waiting for dates in the \u201cdd\/mm\/yyyy\u201d format. You could do it like this:<\/p>\n<pre class=\"prettyprint\"><code lang=\"ruby\">Date.strptime(date, '%d\/%m\/%Y')<\/code><\/pre>\n<p>This will be considerably faster than what you\u2019d get by using the Date#parse method.<\/p>\n<p>Now let\u2019s consider type checks.<\/p>\n<p>The\u00a0Object#class, Object#is_a?, and Object#kind_of? methods might present bad performance when used in loops. The checks can take about 20ms, in large-ish loops. That might not sound too awful, but those times add up. Imagine a web application that performs such a comparison millions of times per request. If it\u2019s possible, it\u2019s advisable to move the calls to those functions away from iterators or even methods that called a lot.<\/p>\n<h3>The Right Tool for the Job<\/h3>\n<p>I\u2019ll finish this post of tips on how to tune Ruby performance by advising you to\u2026 not write Ruby code all the time. Yeah, I know this might sound weird and defeatist, but hear me out for a moment. Ruby is an awesome language, and it\u2019s a general, multi-purpose language. This means that, yes, in theory, there\u2019s nothing stopping you from using Ruby to solve any kind of problem. But just because you can, does not mean you necessarily should.<\/p>\n<p>The essential point of this section is to say while Ruby is a great language, it doesn\u2019t have to be the sole tool in your tool belt. It\u2019s perfectly okay for you to mix and match and use other tools in areas where Ruby doesn\u2019t shine.<\/p>\n<p>With that out of the way, let\u2019s stop talking abstractions. Instead, we\u2019ll offer examples of realistic scenarios where maybe Ruby isn\u2019t the greatest choice, performance-wise. We\u2019ll also talk about better alternatives.<\/p>\n<h4>C to the rescue<\/h4>\n<p>Since the main implementation of Ruby is written in C, rewriting a slow part of your Ruby code in C is always an alternative when you\u2019re facing performance issues. But there are better ways of leveraging the power of C\u2019s raw performance than writing fixes yourself. How would you do that? Simple: by using gems written by third parties in C.<\/p>\n<p>Some authors identify at least two types of those gems written in C. The first type would be gems that should replace slow parts of the Ruby language or even the Ruby on Rails framework. The other type refers to gems that implement specific tasks in C.<\/p>\n<h4>Database to the rescue<\/h4>\n<p>It\u2019s not uncommon these days for developers\u2014especially web developers\u2014to ignore the most advanced capabilities of databases, using them essentially as glorified data storage tools. And that\u2019s unfortunate since databases often have sophisticated ways of dealing with complex computations using large amounts of data. This shouldn\u2019t be that surprising, but many developers miss out on those features.<\/p>\n<p>They probably opt for the comfort of relying on abstractions such as ORMs in order to not have to deal with SQL and other complex and inconvenient facets of databases. But by doing that, those developers are renouncing the data processing capabilities offered by those database systems. Understanding how to best leverages SQL databases and ORMs is a key component to successful Ruby performance tuning.<\/p>\n<p>Sometimes, when doing classification or ranking of data, you find yourself in a bad performance scenario, even after installing several gems and using them exactly as told. Maybe in this situation, the best solution would be to just perform the computation in SQL and be done with it.<\/p>\n<p>Sometimes developers will struggle with their ORMs or other tools when often-neglected database features such as materialized views would be a better solution.<\/p>\n<h3>Tools at your disposal<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-25355 size-full\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/06\/hardware-1.jpg\" alt=\"\" width=\"1401\" height=\"856\" \/><\/p>\n<p>Today\u2019s post featured basic tips you can apply to optimize the performance of your Ruby application. The list isn\u2019t exhaustive by any means; rather, treat it as a starting point to help you understand some of the most common Ruby performance problems.<\/p>\n<p>Once you get the right mindset, you will identify and troubleshoot not only the problems covered in this post but also problems in other areas.<\/p>\n<p>You don\u2019t have to face that journey all alone though. There are tools available that can help you troubleshoot performance issues in your Ruby and Ruby on Rails applications.<\/p>\n<p>One of these tools is <a href=\"https:\/\/stackify.com\/retrace\/\" target=\"_blank\" rel=\"noopener noreferrer\">Retrace<\/a>, a leading APM tool by Stackify. Some of Retrace\u2019s features include:<\/p>\n<ul>\n<li>App performance monitoring<\/li>\n<li>Code profiling<\/li>\n<li>Error management<\/li>\n<li>Error tracking<\/li>\n<li>Centralized logging<\/li>\n<\/ul>\n<p><a id=\"post-23643-_gjdgxs\"><\/a> This might be just what you needed to take the performance of your Ruby apps to a whole new level.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many things to praise about the Ruby language: adherence to the object orientation paradigm, simplicity, elegance, and powerful meta-programming capabilities. Unfortunately, performance isn\u2019t top of mind when people think about the many qualities of the language. For years, people have been denouncing the Ruby programming language as slow. Is it? Sure, some people [&hellip;]<\/p>\n","protected":false},"author":51,"featured_media":37242,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7],"tags":[28,108,52],"class_list":["post-23643","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","tag-apm","tag-application-performance","tag-developer-tips"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v25.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ruby Performance Tuning - Stackify<\/title>\n<meta name=\"description\" content=\"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stackify.com\/ruby-performance-tuning\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ruby Performance Tuning - Stackify\" \/>\n<meta property=\"og:description\" content=\"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stackify.com\/ruby-performance-tuning\/\" \/>\n<meta property=\"og:site_name\" content=\"Stackify\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Stackify\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-12T12:25:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-19T05:39:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"881\" \/>\n\t<meta property=\"og:image:height\" content=\"441\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Carlos Schults\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@stackify\" \/>\n<meta name=\"twitter:site\" content=\"@stackify\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carlos Schults\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/\"},\"author\":{\"name\":\"Carlos Schults\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/a2c7c17b5fe2f06e980401be402144f9\"},\"headline\":\"Ruby Performance Tuning\",\"datePublished\":\"2019-01-12T12:25:10+00:00\",\"dateModified\":\"2024-04-19T05:39:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/\"},\"wordCount\":2117,\"publisher\":{\"@id\":\"https:\/\/stackify.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg\",\"keywords\":[\"apm\",\"application performance\",\"developer tips\"],\"articleSection\":[\"Developer Tips, Tricks &amp; Resources\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/\",\"url\":\"https:\/\/stackify.com\/ruby-performance-tuning\/\",\"name\":\"Ruby Performance Tuning - Stackify\",\"isPartOf\":{\"@id\":\"https:\/\/stackify.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg\",\"datePublished\":\"2019-01-12T12:25:10+00:00\",\"dateModified\":\"2024-04-19T05:39:25+00:00\",\"description\":\"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/stackify.com\/ruby-performance-tuning\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage\",\"url\":\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg\",\"contentUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg\",\"width\":881,\"height\":441},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/stackify.com\/#website\",\"url\":\"https:\/\/stackify.com\/\",\"name\":\"Stackify\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/stackify.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/stackify.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/stackify.com\/#organization\",\"name\":\"Stackify\",\"url\":\"https:\/\/stackify.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png\",\"contentUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png\",\"width\":1377,\"height\":430,\"caption\":\"Stackify\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Stackify\/\",\"https:\/\/x.com\/stackify\",\"https:\/\/www.instagram.com\/stackify\/\",\"https:\/\/www.linkedin.com\/company\/2596184\",\"https:\/\/www.youtube.com\/stackify\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/a2c7c17b5fe2f06e980401be402144f9\",\"name\":\"Carlos Schults\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8670234f2c915bc75058e81ac91bf8ff?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8670234f2c915bc75058e81ac91bf8ff?s=96&d=mm&r=g\",\"caption\":\"Carlos Schults\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ruby Performance Tuning - Stackify","description":"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.","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:\/\/stackify.com\/ruby-performance-tuning\/","og_locale":"en_US","og_type":"article","og_title":"Ruby Performance Tuning - Stackify","og_description":"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.","og_url":"https:\/\/stackify.com\/ruby-performance-tuning\/","og_site_name":"Stackify","article_publisher":"https:\/\/www.facebook.com\/Stackify\/","article_published_time":"2019-01-12T12:25:10+00:00","article_modified_time":"2024-04-19T05:39:25+00:00","og_image":[{"width":881,"height":441,"url":"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg","type":"image\/jpeg"}],"author":"Carlos Schults","twitter_card":"summary_large_image","twitter_creator":"@stackify","twitter_site":"@stackify","twitter_misc":{"Written by":"Carlos Schults","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/stackify.com\/ruby-performance-tuning\/#article","isPartOf":{"@id":"https:\/\/stackify.com\/ruby-performance-tuning\/"},"author":{"name":"Carlos Schults","@id":"https:\/\/stackify.com\/#\/schema\/person\/a2c7c17b5fe2f06e980401be402144f9"},"headline":"Ruby Performance Tuning","datePublished":"2019-01-12T12:25:10+00:00","dateModified":"2024-04-19T05:39:25+00:00","mainEntityOfPage":{"@id":"https:\/\/stackify.com\/ruby-performance-tuning\/"},"wordCount":2117,"publisher":{"@id":"https:\/\/stackify.com\/#organization"},"image":{"@id":"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage"},"thumbnailUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg","keywords":["apm","application performance","developer tips"],"articleSection":["Developer Tips, Tricks &amp; Resources"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/stackify.com\/ruby-performance-tuning\/","url":"https:\/\/stackify.com\/ruby-performance-tuning\/","name":"Ruby Performance Tuning - Stackify","isPartOf":{"@id":"https:\/\/stackify.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage"},"image":{"@id":"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage"},"thumbnailUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg","datePublished":"2019-01-12T12:25:10+00:00","dateModified":"2024-04-19T05:39:25+00:00","description":"Understand the reasons for Ruby performance issues and get practical tips on what to do to improve the performance of your Ruby apps.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stackify.com\/ruby-performance-tuning\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/ruby-performance-tuning\/#primaryimage","url":"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg","contentUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2019\/01\/Ruby-Performance-Tuning-881x441-1.jpg","width":881,"height":441},{"@type":"WebSite","@id":"https:\/\/stackify.com\/#website","url":"https:\/\/stackify.com\/","name":"Stackify","description":"","publisher":{"@id":"https:\/\/stackify.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stackify.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/stackify.com\/#organization","name":"Stackify","url":"https:\/\/stackify.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/#\/schema\/logo\/image\/","url":"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png","contentUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png","width":1377,"height":430,"caption":"Stackify"},"image":{"@id":"https:\/\/stackify.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Stackify\/","https:\/\/x.com\/stackify","https:\/\/www.instagram.com\/stackify\/","https:\/\/www.linkedin.com\/company\/2596184","https:\/\/www.youtube.com\/stackify"]},{"@type":"Person","@id":"https:\/\/stackify.com\/#\/schema\/person\/a2c7c17b5fe2f06e980401be402144f9","name":"Carlos Schults","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8670234f2c915bc75058e81ac91bf8ff?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8670234f2c915bc75058e81ac91bf8ff?s=96&d=mm&r=g","caption":"Carlos Schults"}}]}},"_links":{"self":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/23643"}],"collection":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/comments?post=23643"}],"version-history":[{"count":4,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/23643\/revisions"}],"predecessor-version":[{"id":43974,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/23643\/revisions\/43974"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/media\/37242"}],"wp:attachment":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/media?parent=23643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/categories?post=23643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/tags?post=23643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}