Programming Languages – Simple Speed Test

swift-heroI wrote a very basic speed test in SwiftJavaJavaScript, C / C++, PythonRuby, and Perl. Awesome is the speed of Swift. It’s up to two times faster than Java und up to 3 times faster than C / C++ depending which function will be used. For this test I implemented the following simple function:

    long sum = 0;
    for (Integer n = max; n > 0;  n--) {
        double foo = n / 17;
        sum = sum + n ;
    }

I published the test on gitHub. If you want to implement more complex / meaningful tests or found a bug please please contribute some code. ?

https://github.com/AndreasPrang/Programming-Languages-Speed-Test

 

Language wiime Elapsed
Swift 232ms
Java 518ms
JavaScript 606ms
C 1016ms
Objective-C 1062ms
C++ 1065ms
Python 7796ms
Ruby 8666ms
Perl 19673ms

Install GlassFish 4 with Oracle JDK RedHat / CentOS

glassfishDie Installation von GlassFish 4.0 schlägt auf Linux-Systemen welche nicht in englisch installiert sind fehlt. Die folgenden Schritte funktionieren:

 

# uninstall openJDK
   0   yum remove java-1.6.0-openjdk      

# download Oracle JDK
   0   http://www.oracle.com/technetwork/java/javase/downloads/index.html
# install Oracle JAVA
   0   yum reinstall '/tmp/jdk-7u45-linux-x64.rpm' 
   1   java
   2   java -version
   3   alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/jre/bin/java 20000
   4   alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_45/bin/jar 20000
   5   alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_45/bin/javac 20000
   6   alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_45/jre/bin/javaws 20000
   7   java -version
   8   ls -lA /etc/alternatives/
   9   alternatives --set java /usr/java/jdk1.7.0_45/jre/bin/java
   10  alternatives --set javaws /usr/java/jdk1.7.0_45/jre/bin/javaws
   11  alternatives --set javac /usr/java/jdk1.7.0_45/bin/javac
   12  alternatives --set jar /usr/java/jdk1.7.0_45/bin/jar
   13  update-alternatives --install "/usr/bin/jar" "jar" "/usr/java/jdk1.7.0_45/bin/jar" 1
   14  java -version
   15  export JAVA_HOME=/usr/java/jdk1.7.0_45/bin/java

# install GlassFisht 4.0
   0   wget http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip
   1   unzip -d /opt/oracle/ glassfish-4.0.zip
       # Full edition:
   2a wget http://download.java.net/glassfish/4.0/release/glassfish-4.0-unix.sh
./glassfish-4.0-unix.sh
       # Webedition:
   2b wget http://download.java.net/glassfish/4.0/release/glassfish-4.0-web-unix.sh
./glassfish-4.0-web-unix.sh
       # Avoid error: Fehler beim Rendern von SWIXML Frame=content area Verursacht durch: Invalid SwiXML Descriptor.
   3   LANG=EN sh ./glassfish-4.0-unix.sh
   4   Follow this perfect instructions: https://blog.hazrulnizam.com/?p=207