i think that your example there is not very good. if u have a math functions then it cant take both int and double as a parameter. u could of course pass both (as separate parameters) and have a flag or something indicating which one is to be used, however, if u r going to do that and use if statement then u r still writing code twice. so the answer is pretty clear: write 2 functions. make your code easier to maintain and to understand. not to mention faster.

if u r refering to classes, u could pass a super class object. but then the function should be able to handle all classes extending the super class. if u want to perform a specific operation on an extended class object then write it specific for that class.

i dont think u make a program more efficient by making it smaller. it could have hundreds of if statements etc, which makes it less efficient. by craming the code u make it hard to debug, hard to modify and understand, slower etc.

if u have more than 4, 5 nested loops or switch and if statements then u should probably consider splitting the function into few smaller chunks. think about what u r going to code. try to make it simple and easy to follow. make sure that when u come back to your program in a few weeks u will be able to understand what is going on straight away.