There is not a common way of doing this because it's not a common requirement, presumably if there are parameters in the url it's usually because some element or script in the browser put them there so this information is usually (but not always as in the case of bookmarks) available elsewhere on the page. What is more common is for the server script (ruby, python, aspx, php, etx.) to embed all the parameters the script is going to need directly in the page.
For example in .Net using the Razor templating engine you might do
<script>
(function() {
var model = @Html.Json(Model);
....
})
</script>
Where @Html.Json(Model) would run on the server and json-serialize the model into the model variable (which is valid javascript after all).
As for performance, this script should run at most once per page load so who cares? You would have trouble finding a way of writing it that's so bad that it would cause problems.
There are however a few somewhat minor style and logic issues. Here is how I would do something similar:
// I don't like the function name() syntax - it hides what's really going on, which is this:
var getUrlVars = function() {
//technically i and len are initialized first due to variable hosisting anyways so Douglass Crockford recommends doing it here
//I personally think its ok to declare your variables lower as long as you're comfortable with the concept
var i, len,
params = {}, // no idea why the previous function used an array
hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
//Array.length is actually a very rare instance of a calculated property, this syntax ensures it is only calculated once at
//the beginning of looping.
// Also Crockford recommends not using ++ on account of it being a silly construct that can lead to bad practices
for(i = 0, len = hashes.length, len; i < len; i+=1) {
hash = hashes[i].split('=');
//no idea why there was a push here previously, it gets overridden by the next line
params[hash[0]] = hash[1];
}
return params;
}