Since setting up my development environments on Mac OS X Lion (brand new macbook air purchased in January 2012), I have noticed that resolving to a virtual host is very slow (around 3 seconds) the first time but after that is fast as long as I continue loading it regularly.

If I leave it untouched for a couple of minutes and then reload again, the first reload is (again) painfully slow; seems like something is being cached. 

As can be seen below I am not using the .local TLD.

My setup: Apache 2 - MySQL - PHP installed and enabled - added a couple of virtual hosts one of which I created for localhost

My /etc/hosts:

```
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1       myproject.dev
::1             myproject.dev
fe80::1%lo0     myproject.dev

```

My virtual host set-up in username.conf: 

```
NameVirtualHost *:80

<Directory "/Users/myusername/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /Users/myusername/Dropbox/dev_envs/
</VirtualHost>
<VirtualHost *:80>
    ServerName myproject.dev
    DocumentRoot /Users/myusername/Dropbox/dev_envs/myprojectname
</VirtualHost>

```
['https://Stackoverflow.com/questions/10064581', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/61232/']
Make sure to put the IP v6 entries not in the line with localhost

```
::1 localhost

```

the IP v6 entries go in a separate line

```
fe80::1%lo0 here and_here

```

It is sometimes really fast now, but there are rare exceptions where the old lags come back. They might however be based on other reasons.
I had this same problem and finally realized I had the same host entry twice on the same line:

e.g.

```
127.0.0.1 localhost host1 host2 host3 host4 host5 host1 host6

```

I removed the second instance of the same host (in the example above - host1) - and things immediately sped up.

Felt a little silly when I discovered this, but when you've got 10 long host names on the same line and you're frequently adding / removing, it can be eaisly overlooked.