First you have to know why there is performance improvement when using subdominio.site.com
.
I believe the advantages are:
CDN:
The static.site.com
is on another server, probably a CDN, specific to distribute this type of static content, the client will connect to the nearest server.
While www.site.com
is still processed by slow PHP for example.
Avoid unnecessary cookie and headers:
Static files do not bind to cookie in normal situations. If you have 500 bytes of cookies stored in the entire domain and have 10 static contents that need to be loaded, the client will send 5000 additional bytes without any reason.
Now, if such 500 cookie bytes are restricted to www.site.com
, it will not be sent when you get static.site.com/js.js
, that will save you 5000 bytes of unnecessary information.
This is also part of "Best Practices for Speeding Up Your Web Site" .
In order to gain some performance using sub.dominio.com
you need to set cookies for only the main site, not including the subdomain, and you can also get some CDN service for it.