How much extra overhead do generics have?
If you overgeneralize the generic, there will be more work to do for the compiler. How do you know when you have overgeneralized? For instance, passing arithmetic operations as parameters is a bad sign. So are boolean or enumeration type generic formal parameters. If you never override the defaults for a parameter, you probably overengineered. Code sharing (if implemented and requested) will cause an additional overhead on some calls, which will be partially offset by improved locality of reference. (Translation, code sharing may win most when cache misses cost most.) If a generic unit is only used once in a program, code sharing always loses. R.R. Software chose code sharing as the implementation for generics because 2 or more instantiations of Float_Io in a macro implementation would have made a program too large to run in the amount of memory available on the PC machines that existed in 1983 (usually a 128k or 256k machine). Generics in Ada can also result in loss of information whi