What is more important in an algorithm, small runtime or small memory usage?
The best algorithm must certainly depend on the environment. What type of system is your client? What type of system is your server? What kind of transport system stands between them?

If, for example, your clients are Raspberry Pis then it is likely you want to reduce the amount of work you need to do on the client end - take the log(n) option.

If, your client is a Mars Rover you want to minimise the amount of data you need to send and minimise the computation required at the client. Perhaps use the log(n) option, perhaps not - depends on the cost of transporting the data and the computation cost at the other end.

If, however, your server is the LHC then use the n approach - you have probably the largest data bandwidth on the planet and the least amount of time to offload that data you've just collected.