Open olamiko opened 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.
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 thecomics
variable fromcreateIndex
to thesearchForPattern
function. What do you think? I would reduce expensive operations