Sat, 31 Oct 2009 23:10:56 GMT

Power Tools and Pumpkin Cutting

spacer
DSC_0189.JPG, originally uploaded by krow.

Read Comments/Leave Comments

Thu, 29 Oct 2009 19:45:18 GMT

Game, Which is faster?

Last night while working with someone I am tutoring we got into a conversation of "what is faster". Below is some assembler that was created from it, for two different programs which did exactly the same thing, but in different ways.

The question is, which is faster?
Second Question, which do you think was the more maintainable code?


.file "?"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $2097184, %rsp
leaq -2097184(%rbp), %rax
movl $1048576, %edx
movl $64, %esi
movq %rax, %rdi
call memset
movl $0, -20(%rbp)
jmp .L2
.L5:
leaq -1048608(%rbp), %rax
movq %rax, -16(%rbp)
leaq -2097184(%rbp), %rax
movq %rax, -8(%rbp)
jmp .L3
.L7:
nop
.L3:
movq -8(%rbp), %rax
movzbl (%rax), %edx
movq -16(%rbp), %rax
movb %dl, (%rax)
movq -16(%rbp), %rax
leaq 1(%rax), %rdx
movq -8(%rbp), %rax
addq $1, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 2(%rax), %rdx
movq -8(%rbp), %rax
addq $2, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 3(%rax), %rdx
movq -8(%rbp), %rax
addq $3, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 4(%rax), %rdx
movq -8(%rbp), %rax
addq $4, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 5(%rax), %rdx
movq -8(%rbp), %rax
addq $5, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 6(%rax), %rdx
movq -8(%rbp), %rax
addq $6, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
movq -16(%rbp), %rax
leaq 7(%rax), %rdx
movq -8(%rbp), %rax
addq $7, %rax
movzbl (%rax), %eax
movb %al, (%rdx)
addq $8, -16(%rbp)
addq $8, -8(%rbp)
leaq -1048608(%rbp), %rax
addq $1048576, %rax
cmpq -16(%rbp), %rax
jne .L7
.L4:
addl $1, -20(%rbp)
.L2:
cmpl $4095, -20(%rbp)
jbe .L5
movl $0, %eax
leave
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.4.1 20090725 (Red Hat 4.4.1-2)"
.section .note.GNU-stack,"",@progbits



.file "?"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $2097184, %rsp
leaq -2097184(%rbp), %rax
movl $1048576, %edx
movl $64, %esi
movq %rax, %rdi
call memset
movl $0, -20(%rbp)
jmp .L2
.L5:
leaq -1048608(%rbp), %rax
movq %rax, -16(%rbp)
leaq -2097184(%rbp), %rax
movq %rax, -8(%rbp)
jmp .L3
.L4:
movq -8(%rbp), %rax
movzbl (%rax), %edx
movq -16(%rbp), %rax
movb %dl, (%rax)
addq $1, -16(%rbp)
addq $1, -8(%rbp)
.L3:
leaq -1048608(%rbp), %rax
addq $1048576, %rax
cmpq -16(%rbp), %rax
jne .L4
addl $1, -20(%rbp)
.L2:
cmpl $4095, -20(%rbp)
jbe .L5
movl $0, %eax
leave
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.4.1 20090725 (Red Hat 4.4.1-2)"
.section .note.GNU-stack,"",@progbits

Read Comments/Leave Comments

Sun, 25 Oct 2009 00:37:20 GMT

"Fish" Foot Massage

When someone asks "Do you want to get a fish foot massage?", do not assume you just aren't hearing them well and that all you will be receiving a plain old foot massage.

Yes, those are fish in the picture, and yes they are eating the dead skin from my feet.

This is the first time I ever wanted to keep fish around the house. It tickles, but once you get past that?

Awesome :)
spacer

Read Comments/Leave Comments

Fri, 23 Oct 2009 04:39:55 GMT

Guess!

spacer

Read Comments/Leave Comments

All Journal Entries

Who me?

spacer
So who is brian?
Mission
RSS
Software
Talks
Wishlist!
LibraryThing
Bookmarks
Twitter
Location: Seattle, WA.

Interests

appliance computing, asterisk, bluetooth, books, camper van beethoven, capital hill, chai, community, computing as electricity, cooking, databases, diamond age, dogs, ipod, languages, music, mysql, open source, pro-choice, programming, radio, science fiction, seattle, sip, tilting at windmills, traveling, vegetarianism, voip, walking, wearable computers, ?

dopplr

Clicky Clicky!

cloud

Stuff I am reading...

Recent Posts

Can I sell you on Buddy Cam?

And you only hear about this happing in the Middle East

Engine Discovery

Kids and their parents....

Train, Compared to planes...

Green Technology, Toss out your Solid State Drive?

Glasses, Broken...

Nokia 800...

Google Maps, Treo Edition

Library Thing, Shelfari, Book Social Networks

IE vs Firefox

What are these stick pins from the sky?

Queue servers, temporal, stab at it...

My iPhone Prediction

Page Counters, A different approach...

Elsewhere

  • LiveJournal
  • Facebook
  • Dodgeball
  • Twitter
  • Dopplr
  • del.icio.us
  • Slashdot

Copyright Brian Aker, 1994-2008

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.