110
bahua
12d

A guy on another team who is regarded by non-programmers as a genius wrote a python script that goes out to thousands of our appliances, collects information, compiles it, and presents it in a kinda sorta readable, but completely non-transferable format. It takes about 25 minutes to run, and he runs it himself every morning. He comes in early to run it before his team's standup.

I wanted to use that data for apps I wrote, but his impossible format made that impractical, so I took apart his code, rewrote it in perl, replaced all the outrageous hard-coded root passwords with public keys, and added concurrency features. My script dumps the data into a memory-resident backend, and my filterable, sortable, taggable web "frontend"(very generous nomenclature) presents the data in html, csv, and json. Compared to the genius's 25 minute script that he runs himself in the morning, mine runs in about 45 seconds, and runs automatically in cron every two hours.

Optimized!

Comments
  • 18
    Other teams guy:
    "something 's fucky"
    Other teams lead:
    "sshhhh..
    .. You're promoted to customer"
  • 6
    @bahua
    I believe your intention and general behaviour does not match my previous comment.

    Sincerely,
    I'm yealous of your skills / ecosystem / surroundings.
    Keep it up.
  • 2
    Jealousy?
  • 4
    @scor

    Not trying to toot my own horn as much as I'm trying to point out that the guy who wrote the original script was so highly thought of, when his approach was so terrible.
  • 8
    @bahua .....
    perl???
  • 6
    @magicMirror

    It might not be as popular as other languages, but nothing comes close to it in terms of performance and efficiency for parsing text, other than compiled code.
  • 3
    @bahua Well - perl has it uses.
    When was this?
  • 3
    Early to mid 2019, thereabout.
  • 10
    Very good job. Here is Haxk20 award of optimization. Feel free to use it on devRant.

    P.S: This award is only valid on devRant and only to those people who know Haxk20. This award is useless outside of devRant.
  • 6
    \o/ Perl
  • 8
    Well, when the guys original code was named "breakmaker.sh" it should have clued you in. Especially when in the same directory it had compiling1hour.sh, compiling2hours.sh, and compilingallday.sh.
  • 6
    @Haxk20 I'd be careful - that remark in the end might provoke him to create a script that exports the reward in HTML, CSV and JSON just out of spite.

    @Demolishun was there any "pretend_busy.sh" as well?
  • 2
    @theKarlisK no one can forge my award. I have my ways of knowing
  • 4
    @Haxk20 *puts on his pirate hat aand fake eyepatch* Yarr! If it can be viewed it can be pirated tharr matey!
  • 2
  • 1
    @theKarlisK

    Eyepatch..
    Viewed..

    ..ok.

    ='D
  • 1
    @ThatPerlDeb

    Perl \o/
    woopwoop \o/
  • 2
    perl made me throw up a little bit
  • 4
    I can see it your way, but look at it this way too: your colleague took initiative and delivered value. Not saying this describes you; but I sometimes encounter Devs in the workplace who are great at telling you why something existing doesn't work, but seen to lose all their smarts when asked to build something new. I guess what I'm saying is, your colleague did display skill, just of a different kind.
  • 3
    @K-Hole

    I agree. He took the initiative. I'm just surprised that nobody saw anything wrong until I looked at his code.

    He's not an idiot, he just doesn't have much idea of or interest in best practices.
  • 3
    @bahua Some people get the idea that what they wrote is okay even when it is not. I worked with a guy that was feeding my daemon, written in python, a bunch of text data. I would process the data and send it back. He kept complaining that there was something wrong with my process. I had been testing my daemon with an automated test system that used the same interface. So out of curiosity I logged into the dev server and looked at his C code. He had a bunch of buffer overrun issues and pointer problems. I fixed them, compiled his code, and then informed him of the problem. He was very appreciative of the help, but I am not 100% sure he understood what was going on. So, while people may be capable, sometimes they don't verify their own systems or don't have the capacity to improve past a certain point. Or maybe it just comes down to experience. See enough shit and all problems look the same, for better or worse.
  • 5
    @bahua look at it this way - every piece of software at some point was absolute sh** when compared to the improved/updated newer version.. and some was so impressive when it was initially released that the authors were viewed as geniuses.
  • 1
    So... You're too awesome to do your job unless somebody else solves the issue and you get jealous of the fame they gained. How professional.
  • 2
    @cprn

    Nope, just telling a story about optimization.
  • 2
    @bahua People read into stories way too much on here.
  • 0
    @bahua well. as long as you used warning and strict while doing perl.

    Practice Safe Perl.
  • 1
    @magicMirror

    That's in my muscle memory.
  • 0
    I love stuff like this, as someone who loves perl and deals with the existence of python and its many many fanboys, this is great. 👍
Add Comment