Add direct optimization support to partest
wip speed