Add the following code to the functions.php of your child-theme:

add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );

When you set the value to 100, it means that WordPress compress the image at its highest quality.

If you want to increase the compression, set the number to 75 or less. (instead of 100)
Note that a smaller value may decrease the image quality.

Sources: and