Ask HN: Architecture vs. Performance?
as working on an interesting project, i face a recurring problem which i still struggle on at programming.
The problem I work on is simply an image parsing (language independed). I know _a_ solution of this problem, i've done it before, but i still have the feeling about, how can i solve this better.
The structure of this problem is: - load the image (say bmp) - search the image for certain byte pattern - create a list of this pattern and search for nearby patterns - save the results as new list of structures
So the schoolbook solution would be doing all this step by step. This would also allow to cleanly separate each steps in a certain architecture which would allow some kind of modify-less reuse.
But i also have some solutions in mind, which merges some of these steps to reduce the memory consumption and reduce the iterations done on the data, but then they result in a structure oriented architecture which results in the need of review, rewrite when reusing it. The architecture would finally be a monolithic "x to y converter" architecture.
I know its the all time weighting which is to be decided by creating such an algorithm, but maybe you know some more variants which is not just black and white and takes profit from both views.
Thanks.
2 comments
[ 0.27 ms ] story [ 11.3 ms ] threadBut as sillysaurus says, architecture over performance until performance becomes an issue. Multicore pipelining is a performance optimisation, so its something I would read up on to be prepared for it, but don't try it until you feel you need more performance. Also don't try build it yourself - use a library. Finally, if that still doesn't give you the performance you need, start thinking about merging components together. Profile before thinking too much about performance (but by all means, keep performance in mind so your architecture can be modified to be higher performance later).
[1] If you're using C++, I personally recommend http://threadingbuildingblocks.org/ If you're using another language, it may still be worth taking a peek at the documentation (especially the section on pipelines) to get a feel for what I mean.