- data.zip
- evaluation.pdf
- evaluation.xlsx
- source.zip
- C
- CPP
- VS
- CS
- VS
- Fortran
- Java
- JS
- Perl
- PHP
- Python
|
PROGRAM MEASUREMENT
INTEGER s
INTEGER A (100000), B (100000), C (100000)
INTEGER r
INTEGER i, j
REAL TIMEARRAY (2)
REAL DELAPSE
CALL srand(0)
s = 100000
r = 10000
C Idea for Timing was taken from (gets relative time)
C http://www.phys.ufl.edu/~coldwell/Progdet/UNIX%20FORTRAN%20Timing.htm
C Another approach was found at (gets absolute time)
C http://pc.freeshell.org/comp/fortran
C -----------
C ------
C THIS IS A BASIC PORT OF THE C#-PROGRAM WRITTEN BY SIMON MAGES
C THIS PORT AIMS TO BE AS CLOSE AS POSSIBLE TO THE C# PROGRAM
C PORT DONE BY FLORIAN RAPPL, 2011
C ------
C -----------
C HERE WE GET THE TIME IN SECONDS --- i.e. we have to multiply with Ticks / s
C The Ticks / s is given by Frequency [ Cycles / s ] * 1000 [ Ticks / Cycle ]
do i = 1, s
A(i) = 10 * rand(0) + 1
B(i) = 10 * rand(0) + 1
enddo
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) + B(i)
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '+: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) - B(i)
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '-: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) * B(i)
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '*: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) / B(i)
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '/: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = MOD(A(i), B(i))
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '%: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) / B(i) + MOD(A(i), B(i))
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '/ + %: ', DELAPSE
DELAPSE=DTIME(TIMEARRAY)
do j = 1, r
do i = 1, s
C(i) = A(i) / B(i)
C(i) = C(i) + A(i) - C(i) * B(i)
enddo
enddo
DELAPSE=DTIME(TIMEARRAY)
WRITE (*,*) '/ + -*: ', DELAPSE
END PROGRAM
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Florian lives in Munich, Germany. He started his programming career with Perl. After programming C/C++ for some years he discovered his favorite programming language C#. He did work at Siemens as a programmer until he decided to study Physics.
During his studies he worked as an IT consultant for various companies. After graduating with a PhD in theoretical particle Physics he is working as a senior technical consultant in the field of home automation and IoT.
Florian has been giving lectures in C#, HTML5 with CSS3 and JavaScript, software design, and other topics. He is regularly giving talks at user groups, conferences, and companies. He is actively contributing to open-source projects. Florian is the maintainer of AngleSharp, a completely managed browser engine.