Optimize svg all

Supersedes #1613 #1594 #1552 and #1613