Skip to main content
added 89 characters in body
Source Link
Michel Keijzers
  • 13k
  • 7
  • 43
  • 59

The compiler/linker will remove unused functions/methods automatically, so I doubt you can save memory by removing unused functions/methods yourself.

However, you could possibly gain by:

  • Removing the calls of check functions/methods when you know the result will be always false, true, or always the same number, string or data type in general.
  • Removing (parts of) functions/methods which are related to physical or logical functionality you never use. Like e.g. if, case statements that will never apply).
  • Prevent using an entire class (e.g. String) (see second comment of Emma Makes below).

The compiler/linker will remove unused functions/methods automatically, so I doubt you can save memory by removing unused functions/methods yourself.

However, you could possibly gain by:

  • Removing the calls of check functions/methods when you know the result will be always false, true, or always the same number, string or data type in general.
  • Removing (parts of) functions/methods which are related to physical or logical functionality you never use. Like e.g. if, case statements that will never apply).

The compiler/linker will remove unused functions/methods automatically, so I doubt you can save memory by removing unused functions/methods yourself.

However, you could possibly gain by:

  • Removing the calls of check functions/methods when you know the result will be always false, true, or always the same number, string or data type in general.
  • Removing (parts of) functions/methods which are related to physical or logical functionality you never use. Like e.g. if, case statements that will never apply).
  • Prevent using an entire class (e.g. String) (see second comment of Emma Makes below).
Source Link
Michel Keijzers
  • 13k
  • 7
  • 43
  • 59

The compiler/linker will remove unused functions/methods automatically, so I doubt you can save memory by removing unused functions/methods yourself.

However, you could possibly gain by:

  • Removing the calls of check functions/methods when you know the result will be always false, true, or always the same number, string or data type in general.
  • Removing (parts of) functions/methods which are related to physical or logical functionality you never use. Like e.g. if, case statements that will never apply).