yhabib / csi

0 stars 0 forks source link

Expensive operations #2

Open olamiko opened 3 years ago

olamiko commented 3 years ago

In the line, you get comics but return the path to file. In the searchForPattern function, you perform a read on the file on this line. Those are duplicate operations that can be done only once if you pass the comics variable from createIndex to the searchForPattern function. What do you think? I would reduce expensive operations

yhabib commented 3 years ago

That is true 🤔 I thought this approach would make the code cleaner, as the path becomes the "resource" and main doesn't need to know much about it. But from a performance point of view your point makes sense, if main handles comics one would fill it and the other one would consume, but both working with the pointer.