Starting with OS X 10.10.4 Apple provides a nice utility to enable TRIM on all types of SSDs (all types of storage to be fair).
Be sure your storage device supports TRIM. You’re on your own!
Activate TRIM even for non Apple SSDs by typing this in a Terminal session:
Press y and proceed. Your computer will be instantly restarted after enabling TRIM.