Home » Ruby (page 2)

Ruby

Rust for Java Devs – Creating functions

In this post of Rust for Java Devs we will look at creating functions in Rust. Functions in Rust do not differ that much from Java methods but there are a few little differences. There is also the topic of Rust’s lifetimes compared to Java’s garbage collection that one could argue separates the two from each other a bit more, ...

Read More »

Understanding Rust Loops

When you come from another language to learn Rust, some things may come across the same, but many things will be very different. Writing Rust loops can have the appearance of familiarity, but behind the scenes, Rust is translating those loops to its own syntax. If you learn that style for yourself, you will find Rust loops to be far ...

Read More »

Improving Performance by Writing a Custom Static Asset Server in Rust

The ability to serve static assets is critical for many SaaS products, including Shopblocks. Many of these products will store the files to be served in a segmented way, perhaps across multiple drives, and in multiple folders. At Shopblocks, our setup means that each customer has their assets stored on specific mounted drives, and in specific folders per customer. For ...

Read More »

Rust for Java Devs – Compiling code and using Cargo

After my last post seemed to be well received I am back with another Rust for Java Devs post. Today we will look at a compiling Rust code and have a brief look at using the basics of Cargo. For a developer there isn’t much difference between how to compile Rust code compared to Java, but where they vary are ...

Read More »

Rust Design Considerations with Borrowing

Rust has a fairly unique way of handling memory-freeing by implementing an ownership system. Each code item you create in Rust is assigned ownership/lifetime at the time of its creation. From that point on, you may choose to let the item be borrowed by things further on within the same scope or allow the ownership to be consumed (taken over) ...

Read More »

Rust for Java Devs – Creating Variables

I’m going to do something different today and write about Rust instead of Java. This is something that I want to give a try and if it all goes well I will continue writing some posts about Rust in the future. I will be writing about learning Rust from the perspective of a Java developer by making comparisons where appropriate ...

Read More »

Tracking Object Allocation in Ruby

Whenever you do something like MyClass.new, Ruby creates a new object, which uses a little bit of memory. But that’s not the only way you are creating objects. Many actions will create objects, including strings and arrays. Even if you don’t say String.new or Array.new, it’s still a new object that is being created for you. Because memory is not ...

Read More »

Mixing Ruby and Rust on Heroku

Ruby has been around for a good many years now and has become a quite well-seasoned language. There are many profitable tools, projects, and sites with code written in Ruby, which is a nice thing that we can utilize even in Rust. In this post, I’ll be covering running Ruby code from Rust, touch on Rust from Ruby, and deploying ...

Read More »

Improving Ruby Performance with Rust

A couple of years ago, I found a few methods in my Rails application that were called several thousand times and accounted for more than 30 percent of my website’s page load time. Each of these methods were strictly focused on file pathnames. Along with that, I came across a blog post that said “Rust to the Rescue of Ruby,” ...

Read More »