Railguns and directed energy weapons get massively over-hyped in the media compared to the actual uses they are being developed for in reality.
For local area air defence applications, both suffer from the problem that the atmosphere at sea level is both (a) very thick and (b) very opaque. I don't have the spreadsheets on my home machine, but a hypervelocity projectile will be subjected to a deceleration of tens of gravities at sea level. The primary use case for railguns is long range bombardment, where they are fired steeply into the upper atmosphere to reduce drag. The second role propsed, ABM defence, uses very similar trajectories (up then across).
Weapons such as the Blitzer railgun and basically all the solid state laser projects (Laser Phalanx, laser Millenium gun etc) are about point defence - particularly defending bases against RAM attack in hot and dry places. This requires very fast reaction times, but only short ranges (CIWS). Water vapour is excellent at absorbing IR, so greatly limiting the performance of lasers when firing horizontally.
The other two purposes for DEW - specifically IR lasers - are providing less-lethal methods to defeat small boats at short range (but greater than 750m or whatever the self-destruct range of RPG-7 is) and ABM - the latter by firing straight up thus through less of the soup at sea level. There is of course, the question of HPM weapons, but these are also subject to environmental limitations and may well end up being integrated with the radars themselves.
The time involved in getting a projectile out to 12 miles (horizon) in milliseconds
At 2.4KPS it will take 8 seconds - ignoring any drag. The incoming missile - assuming SS-N-27 attack stage - will have covered approximately 8Km in that time. Railgun projectiles will in fact be small guided weapons, possibly similar to the DART projectiles fired from the Oto 76mm. As to whether they will actually be cheaper than a guided missile, I wouldn't be so sure - given the massive acceleration and EM environment on launch, per pound they will almost certainly end up being more expensive than a conventional missile, the question will be; how much more?
Of course, this is not to say that railguns and DEW are not going to be on future ships - they almost certainly will. However the limitations of the physics involved make it unlikely that they will completely displace missiles soon. *Eventually* they may well do, however. (I worked out that they should have a much lower carbon footprint!
)
RP1