9
mrbig00
6y

So, I've posted a question on StackOverflow. I was curious about better (in terms of performance and cleaner code) ways to solve a problem. And a fckn dickhead added a comment like this: Why worry about performance?

Comments
  • 0
  • 1
    also, kind of lame to call that guy a dickhead w/o posting a link to the question you asked. I have no context to read his comment in.
  • 0
    @commanderkeen sorry, I forgot to add context https://stackoverflow.com/questions...

    In my opinion this kind of task doesn't fall into the premature optimization category, but correct me if I'm wrong
  • 0
    I still think mr dickhead has a point, you are doing a one off task you would probably do in a loop right? Maybe with a cue and a cron? Or all at once in a loop?

    Is it really worth anyones time to optimize this, a pdf would prolly take < 2 seconds to generate (from my limited dompdf experience). So even at worst at 3 seconds its less 3 hours for 2500 pdfs. By the time you've benchemarked and researched the three libaries you could've prolly generated half the pdfs.

    And this is the point with premature optimization, you are fixing bottlenecks before making the actual bottle.
  • 1
    Okay, but I was asking some for some advices. And the answer for that is why do you care about the performance?

    And I get that premature optimisation is not good. But I was wondering that some people made similar tasks and they have some experience.

    I just wanted some advices like: use X, it's not that fast but it's easy to implement, don't use Y it's fast but it's a pain in the ass to implement.

    But hey, as it turns out nowadays you can't even ask for advice from other people, just copy-paste code and let the pdf generation kill the server once a month :)

    ps: it would be okay for you if once a month Netflix would go down for 2-3 hours while they are generating the invoices for the subscription?
  • 1
    Even if it could have been better phrased he is right.
    Performance is not the most important thing in a software:
    it is important to get your code right or it won't scale well but security, stability and compatibility are far more important(and we're talking about pdf rendering, not a huge task).
    None will care if you take 1s more to render your pdf but it won't be acceptable if the result is not correct and trust me, html to pdf is way from perfect (it works but not all libraries are the same and the html may need some modification)
    Also most of the times performance are given by the implementation not the code: even if the PDF library takes forever to render but the rendering is done by a background process and cached the result will be immediate (just an example)
  • 0
    @mrbig00 yeah, that ps. is a bit of a strawman argument. I assume you are not netflix making invoices, but you are making 2500 nametags for an event like you said in your SO question.

    Is there any reason you could not just pull the DB of the server and generate the tickets on your local machine? C'mon.

    >But hey, as it turns out nowadays you can't even ask for advice from other people

    says the guy who got an answer that critisized the parameters of his question and instantly started a rant on another site about it...
  • 0
    @commanderkeen yeah, you're probably right about my attitude. I have to improve myself

    But c'mon, I've asked a question and the answer was to bother with performance.

    Regarding the why I don't generate it on my pc, it's a recurring weekly event and I don't want to waste my time with this.
Add Comment