32

Fuck i love regex... managed to replace a series of loops and if statements with regex and cut execution time from 60ms down to 5ms

Comments
  • 17
    Also managed to increase the time to understand the code from 5 to 60 minutes
  • 2
    Also, unless you're running that code a couple hundred times then the time saving is basically negligible.
  • 6
    @BadFox any optimization is good optimization
  • 2
    @MrJimmy be careful with what you learn. If you learn regex now, you might have to use it some day!
  • 0
    @beegC0de perhaps, although maybe not for small systems. I can see the use in a system like the internet where 1 ms is massive but in something like a video conversion, 1ms off the conversion time isn't a lot.
  • 0
    @MrJimmy I see "Mr" and I see female avatar. I think to myself "something doesn't add up". Then, I shrug and move on. It's devRant, we're a different people.

    =)
  • 1
    @BadFox well yeah obviously 1ms off an entire transcode is negligible. He got his code to go 6 times faster which isn't negligible.
  • 0
    @beegC0de yes, I know. It went on a tangent. What I meant is, in that case the difference between a total execution time of 60ms Vs 5ms isn't likely to be noticed unless the program is ran several hundred times.
  • 1
    @BadFox well if it ever needs to be run repeatedly it's optimised 8)
  • 2
    But isn't regex itself just an algorithm? So just means their implementation of loop is more efficient than yours?
  • 2
    @billgates its 1 of 2 things... a seried of more efficient loops... or black magic
  • 1
    Crap... I feel I need to invest more time in regex than I have previously had.

    +Add to Todo!
  • 0
Add Comment