Well, there isn't any specific number of variables, because it depends on both the browser and the hardware it's running on.
The best thing to do is to try to minimize your use of story variables (the "$name" variables) by offloading what you can into the Twine and JavaScript code, and then using the "setup" object to store the more static data where you can with the remaining data (like the layout of your map, which I assume won't change).
For an example of offloading the data into Twine or JavaScript, you could have it so that if an object has a (unique) name and a description, use the name to call a function or widget which will give you the description based on the name you pass to it, instead of storing the description on the object. That way you won't be storing that data in the history. Also, you could give items "default" values in various properties, and only store data about properties of the item when it doesn't match the default value, otherwise you pull the default value from your code.
For an example of using the "setup" object, you could randomly create your map and objects at the beginning, and then store the constant features of that data in variables attached to the "setup" object. If the objects stay the same throughout the game (after they're initially randomly generated), and only their locations change, you could store the descriptions of the objects on the "setup" object, and store the locations of the objects in story variables.
If you do this you'll need to write some functions for Config.saves.onLoad and Config.saves.onSave so that the data would be stored on and retrieved from the metadata of the save object. So, just to give some basic sample code for how to use the save object, you could put something like this in you JavaScript section:
Config.saves.onSave = function (save) {
save.setup.VariableName1 = setup.VariableName1;
save.setup.VariableName2 = setup.VariableName2;
};
Config.saves.onLoad = function (save) {
setup.VariableName1 = save.setup.VariableName1;
setup.VariableName2 = save.setup.VariableName2;
};
You would just put your own "setup" variables in place of the above examples. That would allow you to store and retrieve the data for your game that's on the "setup" object, so that it doesn't fill up your history.
Basically, just figure out how to store the minimum possible in story variables, and that should help minimize any slowdown.
Hope that helps!
(Note: The above has been edited to apply TheMadExile's corrections.)