Program size optimization
Using the Serial object pulls HardwareSerial0.o into your program
linkage. This file defines, among other things, the ISRs (interrupt
service routines) associated with the serial port. ISRs are defined
using the ISR() macro from the acr-libc. This macro creates a
function prototype and assigns some attributes to the function,
including the used attribute which tells the linker that it
should consider the function to be used, even if it cannot spot a single
call to it within the compiled program. The ISR cannot then be removed,
and it in turn keeps lots of code from the Serial implementation.
Edit: As pointed out by the busybee in a comment, although f()
cannot be removed at link time, it can be removed at compile time if you
give it the static qualifier. This has the added benefit of triggering
a compiler warning:

warning: 'void f()' defined but not used [-Wunused-function]