I have various loops were I'm performing operations like:
while (sizeof(update_values) > 0)
{
array updates = update_values[..5000];
update_values -= updates;
// do something with 'updates'
}
I guess this results in quite a bit of back-and-forth copying of data in
memory. Since I'm attempting to process the data in a destructive manner
anyway, I'm searching for an operation like Array.shift(update_values,
5000) which could return the (max) 5000 elements I'd be looking for, and
modify the update_values in the same step. Looking through Array and ADT
I am not finding such a feature. Am I overlooking something?
(I could possibly rewrite the code to accomplish a similar but faster,
non-destructive effect
foreach (update_values / 5000, array updates)
{
// do something with 'updates'
}
)
Regards,
Arjan
|