There are some important factors that will severely multiply the cost of an upgrade.
1.) Are you adding a new type of weapon to the ship (ex. didn't have MassDrivers before, now has +5 MD Attack Points)
2.)Are you significantly raising the attack of a ship (ex. Before had 5 MassDriver Pts, now has 25)
3.)Are you adding the ability to Colonize, Transport, Trade, or Construct (big cost on that last one)
4.) Are you upgrading to a larger hull size?
In the end, we use the disatnce from your empire to determine how long it takes to build. Most of the pinch comes in the cost.
Remember, the upgrading is more of a convenience than a game mechanic. If we make it too easy to upgrade, major cheese gets introduced and the feature can ruin the gameplay balance