# Why is Rails boot so slow on macOS?

**URL:** <https://discuss.rubyonrails.org/t/why-is-rails-boot-so-slow-on-macos/74021>\
**Category:** rubyonrails-talk\
**Created:** [March 29, 2020, 2:55am UTC](https://discuss.rubyonrails.org/t/why-is-rails-boot-so-slow-on-macos/74021 "2020-03-29T02:55:18Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![g101](https://avatars.discourse-cdn.com/v4/letter/g/f9ae1b/32.png) [@g101](https://discuss.rubyonrails.org/u/g101)\
**Post date:** [April 7, 2020, 6:21am UTC](https://discuss.rubyonrails.org/t/why-is-rails-boot-so-slow-on-macos/74021/19 "2020-04-07T06:21:45Z")

</div>

I am not a GoLang expert but I created some code to randomly read small files. I created a folder with 10,000 files of size 100 bytes.

```ruby
import (
	"fmt"
	"io/ioutil"
	"math/rand"
	"time"
)

func main() {
	rand.Seed(time.Now().UnixNano())
	start := time.Now()
	for i := 0; i < 10000; i++ {
		file := fmt.Sprint("random_files/", rand.Intn(10000))
		_, err := ioutil.ReadFile(file)
		if err != nil {
			fmt.Println("Err")
		}
	}
	t := time.Now()
	difference := t.Sub(start)
	fmt.Printf("difference = %v\n", difference)
}

```

On macOS Mojave 10.14.6 the results were:

```ruby
user$ ./gofile 
difference = 3.300336361s
user$ ./gofile 
difference = 1.16395616s
user$ ./gofile 
difference = 693.500542ms
...
user$ ./gofile 
difference = 240.043622ms

```

After multiple runs the time eventually leveled off at around 240ms. I assume once all the files were cached by the OS.

Running the same code on same computer but inside a VirtualBox VM running Ubuntu 18.04 LTS, I got the results:

```ruby
$ ./gofile 
difference = 137.963123ms
$ ./gofile 
difference = 129.356798ms
$ ./gofile 
difference = 130.005818ms
$ ./gofile 
difference = 133.438552ms
$ ./gofile 
difference = 115.163246ms
$ ./gofile 
...
$ ./gofile 
difference = 97.664743ms

```

This time leveling off around 100ms.

---

_[View the full topic](https://discuss.rubyonrails.org/t/why-is-rails-boot-so-slow-on-macos/74021)._
