ProcessAPI - Search and Variables

Hi,

Are there any API to search tasks that returns variable values?

or do I have to call getProcessDataInstances for each task instance? If so, are there any performance concerns?

SearchResult result = processAPI.searchHumanTaskInstances(searchOptionsBuilder.done());

for (HumanTaskInstance instance : result.getResult())
for (DataInstance data : processAPI.getProcessDataInstances(instance.getParentProcessInstanceId(), 0, 100))
// do something with data

Thank you