A method for processing an input sequence of a plurality of function calls on at least one processor, the function calls being requests made by a computer program code and which are applied to data to provide return values, wherein the function calls of the plurality of function calls are associated with an abort probability, the abort probability of a particular function call being a statistical measure based on the outcome of previous processing iterations of a function call and indicating a probability that processing the particular function call causes an abort of the processing of the input sequence, and wherein the function calls of the plurality of function calls are associated with a processing cost on the basis of a number of processor instructions of the respective function call and the abort probability of the respective function call, wherein the method comprises, at the at least one processor: processing at least a subset of the plurality of function calls according to the input sequence, at least until a particular function call aborts the processing of the input sequence, updating the abort probability for at least the processed subset of the plurality of function calls, based on whether or not the processing of the respective function call caused an abort; updating the processing cost per function call for at least the processed subset of the plurality of function calls; determining an updated input sequence by rearranging the order of the function calls at least on the basis of the processing cost of the function calls comprising - determining an average expected cost for each permutation of function calls in the input sequence by: ∘ determining a dependent success probability for at least the processed subset of the plurality of function calls; ∘ determining for each permutation of function calls the sum of all products of the dependent success probability and the processing cost for at least the processed subset of the plurality of function calls; - selecting the permutation with the minimal average expected cost; - rearranging the order of function calls on the basis of the selected permutation. processing at least a subset of the plurality of function calls according to the input sequence, at least until a particular function call aborts the processing of the input sequence, updating the abort probability for at least the processed subset of the plurality of function calls, based on whether or not the processing of the respective function call caused an abort; updating the processing cost per function call for at least the processed subset of the plurality of function calls; determining an updated input sequence by rearranging the order of the function calls at least on the basis of the processing cost of the function calls comprising - determining an average expected cost for each permutation of function calls in the input sequence by: ∘ determining a dependent success probability for at least the processed subset of the plurality of function calls; ∘ determining for each permutation of function calls the sum of all products of the dependent success probability and the processing cost for at least the processed subset of the plurality of function calls; - selecting the permutation with the minimal average expected cost; - rearranging the order of function calls on the basis of the selected permutation. - determining an average expected cost for each permutation of function calls in the input sequence by: ∘ determining a dependent success probability for at least the processed subset of the plurality of function calls; ∘ determining for each permutation of function calls the sum of all products of the dependent success probability and the processing cost for at least the processed subset of the plurality of function calls; ∘ determining a dependent success probability for at least the processed subset of the plurality of function calls; ∘ determining for each permutation of function calls the sum of all products of the dependent success probability and the processing cost for at least the processed subset of the plurality of function calls; - selecting the permutation with the minimal average expected cost; - rearranging the order of function calls on the basis of the selected permutation.