Skip to content

Margus Roo –

If you're inventing and pioneering, you have to be willing to be misunderstood for long periods of time

  • Cloudbreak Autoscale fix
  • Endast

Hello World in different languages and speed

Posted on January 25, 2010 by margusja

Assembler


.section .data
string:
.ascii "Hello world %d \n\0";

.section .text
.globl _start
_start:
movl %esp, %ebp
subl $4, %esp

movl $10000, %eax
movl $0, %ebx

loop:
cmpl $0, %eax
je loop_end
subl $1, %eax
pushl %eax
pushl $string
call printf
addl $4, %esp
popl %eax
jmp loop

loop_end:

movl $1, %eax

movl $0, %ebx

int $0x80

real 0m0.424s
user 0m0.004s
sys 0m0.254s

PHP



real 0m0.969s
user 0m0.034s
sys 0m0.219s
}
?>

Perl

for ($count=0; $count<10000; $count++) { print "Hello World\n"; }

real 0m0.547s
user 0m0.014s
sys 0m0.267s

Python

#!/usr/bin/python
# Filename: hello.py

for i in range(0, 10000):
print "Hello, World!"
else:
print 'The for loop is over'

real 0m0.503s
user 0m0.018s
sys 0m0.273s

Posted in Linux

Post navigation

Mac OS X 10.6 wrong umask on samba share
Sex in my computer vol2

Leave a Reply

You must be logged in to post a comment.

The Master

Categories

  • Apache
  • Apple
  • Assembler
  • Audi
  • BigData
  • BMW
  • C
  • Elektroonika
  • Fun
  • Hadoop
  • help
  • Infotehnoloogia koolis
  • IOT
  • IT
  • IT eetilised
  • Java
  • Langevarjundus
  • Lapsed
  • lastekodu
  • Linux
  • M-401
  • Mac
  • Machine Learning
  • Matemaatika
  • Math
  • MSP430
  • Muusika
  • neo4j
  • openCL
  • Õpetaja identiteet ja tegevusvõimekus
  • oracle
  • PHP
  • PostgreSql
  • ProM
  • R
  • Turvalisus
  • Varia
  • Windows
Proudly powered by WordPress | Theme: micro, developed by DevriX.