Skip to content

Instantly share code, notes, and snippets.

@XMPPwocky
Created January 22, 2015 18:52
Show Gist options
  • Save XMPPwocky/55e767f1398bb7d468bd to your computer and use it in GitHub Desktop.
Save XMPPwocky/55e767f1398bb7d468bd to your computer and use it in GitHub Desktop.
eedstack_1:
movabsq $72, %r10
movabsq $0, %r11
int $3
retq
.align 0x20
the_function_1:
cmpq $0, %rsp
jbe needstack_1
.rept 40
nop
.endr
inc %eax
cmp $1000000, %eax
jge done_1
call the_function_1
done_1:
retq
.align 0x20
the_function_2:
cmpq $0, %rsp
ja body_2
movabsq $72, %r10
movabsq $0, %r11
callq __morestack
retq
body_2:
.rept 40
nop
.endr
inc %eax
cmp $1000000, %eax
jge done_2
call the_function_2
done_2:
retq
.globl main
.type main, @function
main:
.rept 1000
xor %eax, %eax
call the_function_1
.endr
retq
wocky@XMPPwocky:~/cachelol$ time ./old
real 0m9.632s
user 0m9.597s
sys 0m0.000s
wocky@XMPPwocky:~/cachelol$ time ./new
real 0m8.603s
user 0m8.557s
sys 0m0.016s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment