4 ms·
Premature optimization can be an expensive mistake to make... It may feel "wrong" to use 10X or even 100X CPU cycles when you "know" that you could do it in X,
by compumike 14y ago
Premature optimization can be an expensive mistake to make... It may feel "wrong" to use 10X or even 100X CPU cycles when you "know" that you could do it in X, but if the 100X cycle solution still fits the business requirements of the overall system, and takes a lot less programmer time, which path would you choose?
- revelation 14y agoIf, as a progammer, I see something like this render taking 10 seconds, I will shake my head in confusion and think "what the hell is taking up all this time". Stuff like loading the same font a hundred times, allocating memory for all the same symbols - identifying and getting rid of that is not premature optimization, its plain fixing the code. Of course you might have done all of that - no way to know unless you tell us more about the actual pipeline.
- bazzargh 14y agoBut this sounds more like 'no optimisation', and a lot of complexity to maintain. I'm scratching my head over the toolchain chosen. The output is PNG, EPS, PDF, SVG, but you're using Inkscape and Ghostscript? Something seems off there. Cairo has all of those backends already, it's fast and you can call it from python (via pycairo). What's more, Inkscape already uses it as a backend. There's even another schematic editor (gEDA) that uses it, AFAIK. But, I presume you didn't use cairo for a reason - or you are using it, but need those other tools to post-process its output somehow. I'd be interested to know why?
- judofyr 14y agoPremature optimization is not about "optimizing before you need it", it's about optimizing before you've measured it. In this case, you have already measured it; you know the cost. There's nothing premature of optimizing at this moment. I would consider spending a day profiling the current setup to figure out exactly how much you could optimize. > and takes a lot less programmer time I don't see how this is true. You've already spent time setting up a distributed system from scratch (pretty much at least), and you also need to maintain it. Distributed systems are complicated stuff; lots of stuff that can go wrong. If the optimization made it possible to use a single machine, it would be much easier to grasp and debug.