Open donbonifacio opened 7 years ago
Hello Pedro, yes there is definitely space to do some optimisations to the code relative to time/space complexity. I used a simple array for simplicity, but since we want to find a collection of data points in a interval, a BST, range tree would do the job quicker, according to wiki O(n log n) :)
The implications of this are requests taking to long to reply, blocking server to handle other requests and with a worker pool in place without a decent backoff retry, will melt and crash the server, been there done that :)
Well, you and me both! :) That were the responses I was looking for.
Would you consider replacing a CPU intensive job in node for some other tech?
Hello,
Thanks for making our challenge! It's always interesting to see new approaches to the problem and to learn from it. :)
Now the team will leave some questions and provide some feedback. Here is my first one. To filter by the dates, you do:
Imagine that elements is a very huge collection. How could you replace this loop for something faster?
What are the implications of having a CPU heavy operation like that on a request? What would happen to the server?