This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imiell@basquiat $ cat a.sh | |
#!/bin/bash | |
for i in {1..100000} | |
do | |
VAR='HEADERMy voice is my passwordFOOTER' | |
PASS=${VAR#HEADER} | |
PASS=${PASS%FOOTER} | |
done | |
imiell@basquiat $ cat a.py | |
for i in range(100000): | |
var = 'HEADERMy voice is my passwordFOOTER' | |
password = var.lstrip('HEADER') | |
password = password.rstrip('FOOTER') | |
imiell@basquiat $ time ./a.sh | |
real 0m2.442s | |
user 0m2.395s | |
sys 0m0.026s | |
imiell@basquiat $ time python a.py | |
real 0m0.104s | |
user 0m0.085s | |
sys 0m0.010s | |
imiell@basquiat $ cat a.sh | |
#!/bin/bash | |
for i in {1..1000} | |
do | |
VAR='HEADERMy voice is my passwordFOOTER' | |
PASS=${VAR#HEADER} | |
PASS=${PASS%FOOTER} | |
done | |
imiell@basquiat $ cat a.py | |
for i in range(1000): | |
var = 'HEADERMy voice is my passwordFOOTER' | |
password = var.lstrip('HEADER') | |
password = password.rstrip('FOOTER') | |
imiell@basquiat $ time ./a.sh | |
real 0m0.035s | |
user 0m0.034s | |
sys 0m0.001s | |
imiell@basquiat $ time python a.py | |
real 0m0.029s | |
user 0m0.016s | |
sys 0m0.013s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Except that the startup time of python makes a difference here - have updated the gist to reflect the fact that bash is slower after all.