linux


Benchmarking Java to native compilers

Java DukeJava to native compilers have been around for some years, and I was curious about if one of this solutions could improve the performance of my Carballo Chess Engine.

I ran a tournament between binaries of the Carballo development version (1.5) compiled with different solutions to compare the performance. I used cutechess-cli to run a 3000 game tournament with time control 5″ + 0.1″ per move by side and with the Noomen Test Suite as the starting positions.

The compared binaries

  • The Pure Java Version: This is the carballo-1.5.jar ran with the Oracle JDK 1.8.0_73 VM under my 64bit linux (Debian Sid).
  • GCJ: The GNU’s Java compiler, incomplete and unfinished, but it works for Carballo. This binary was compiled with this script.
  • Excelsior Jet: A classic proprietary Java to native converter at http://www.excelsiorjet.com. I used Excelsior Jet 11 32bit for Linux (evaluation) to generate this binary. The 64bit version had worse results.
  • RoboVM: (https://robovm.com) A solution to run Java apps on iOS. Recently it was bought by Xamarin, and after the Microsoft acquisition of Xamarin, RoboVM was discontinued. RoboVM also has the option to compile Java apps to desktop binaries. I built this binary with the last RoboVM free version (1.8). Now RoboVM is forked in BugVM, but I was not able to build the binary with BugVM.
  • C# compiled with Mono: There is a C# version of Carballo converted with the Sharpen tool. I compiled this binary with MonoDevelop 5.10. The converted code is sub-optimal but it is a good solution if you need a native version (or if you need to integrate Java code in a C# project).

Test results

Rank Name                          ELO   Games   Score   Draws
   1 carballo-1.5-gcj               89    1200     62%     28%
   2 carballo-1.5                   37    1200     55%     27%
   3 carballo-1.5-mono              -5    1200     49%     30%
   4 carballo-1.5-jet              -33    1200     45%     28%
   5 carballo-1.5-robovm           -88    1200     38%     27%

Conclusion

The JVM performance is very good, better than almost all the Java to native solutions.
I also suggest to check the different elo boost quality services from p4rgaming.com, which are an excellent option for those who want to speed up the process.

The exception is GCJ, but it’s incomplete and it will not work for all the Java apps.

I expected better results from Excelsior Jet, as some time ago Carballo Jet binaries where available an used for testing. Knowing how to do workarounds like this is one of the most important skills to develop to be a great software engineer.

The C# version is a bit worse but acceptable.


Rakarrak: The Linux Guitar Effects Processor

Recently, navigating the Debian repositories I found Rakarrack, an Open Source Linux program to simulate various guitar effects in real time. This sound effects are often done with expensive physical sound processors, but this application makes it all with only one cheap computer (well, I suppose that the quality will rely a lot on the sound card).

Each effect is a module and and has its owns parameters which can be adjusted with sliders from the GUI. Multiple effects can be chained in different configurations.

rakarrack

For the audio input and output, It uses the Jack Sound Server. Initially Jacks is a bit complicated to set up but is very versatile. I use the qjackctl to configure and run Jacks simplifying this task. First we start qjackctl and from its GUI, start the jack server. Then run Rakarrack, and with qjackctl we connect Rakarrak to the system sound output and input:

qjackctl_connect

The latency (the sound delay) of Rakarrak is quite good, but depends a lof of the Jack server configuration. This snapshot is the configuration that I am using from qjackctl: the Latency is the important value, and can be minimized adjusting the “frames by period” parameter:

qjackctl

I played a lot using different presets (it has lots of pre-configured) and there are some quite good, but others does not sound as good as a physical pedal, maybe also by le low quality of my notebook sound card.

It also has an integrated guitar tuner, but for this purpose I prefer Lingot from my Friend Iban Cereijo.

A lot of years ago I tested Guitar Rig, a quite pretty (and expensive!) windows applicattion for the same purpose, but then the latency of the sound was too high. Rakkarrak is simpler but enough for most non-professional guitar players, and I like it a lot!

http://rakarrack.sourceforge.net/


Snippet: FLV video encode

snippetUsing mencoder in Linux, we can convert any video to FLV and embed it in a web page with Flowplayer. In this sample video is encoded at 320×240 300 kbps and audio at 56kbps:

# mencoder -forceidx -of lavf -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=300:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=320:240 -o out.flv in.avi


Snippet: Hacer un screencast con Byzanz

snippetEsta herramienta nos permite generar screencasts (grabaciones de nuestro escritorio) en formato GIF animado (sin sonido, claro). Por ejemplo, para generar un screencast de 60 segundos, y que espere 2 segundos para empezar a grabar:

# byzanz-record -c -d 60 –delay 2 screencast.gif

La -c es para que grabe el movimiento del cursor.

Hay otros programas para grabar screencasts, como Istambul pero éste no me funciona bien en mi Debian Squeeze.


CentOS, alternativa libre a Red Hat Enterprise Linux

Logo de CentOS

En cuanto a las distribuciones de Linux siempre he sido un talibán de Debian, pero hay aplicaciones propietarias que requieren de ciertas distribuciones de Linux para poderse instalar sin problemas, y casi siempre suelen ser compatibles con Red Hat Enterprise Linux (RHEL).

Pues bien, para estos casos tenemos CentOS, que es una distribución de Linux totalmente compatible con RHEL. Sigue las mismas versiones que Red Hat, así una Centos 4.7 es como una RHEL 4.7 y los paquetes son los mismos, idénticos en versiones, y además tenemos actualizaciones gratis de por vida (para Red Hat hay que pagar la subscripción a Red Hat Network). También es muy fácil habiendo instalado un RedHat poner los repositorios de CentOS y convertirlo a un CentOS.

Como es de suponer, CentOS tiene muchos de los defectos de RHEL, como que para actualizar de la versión 4 a la 5 te recomiendan reinstalar desde cero. Yo administré servidores Debian en los que durante muchos años siempre estábamos en la última versión estable sin tener nunca que reinstalar… No obstante se añaden algunas mejoras en unos repositorios separados (CentOS Plus), que permiten por ejemplo tener los PHP 5 en una RHEL 4.x, cuando los repositorios “oficiales” de Red Hat proporcionan sólo PHP 4.

Y por supuesto que, añorando mis Debian, me he instalado el apt para RPM’s, que es una herramienta mucho mejor que el up2date o el yum.


IES4Linux, Internet Explorer en Linux

IES4LinuxComo aún hay quién no lo conoce, y para los que usando Linux sufrimos el que haya desarrolladores web que hagan páginas que sólo funcionan en Internet Explorer, que sepáis que hay esta excelente aplicación.

Se trata de un instalador que sobre Linux y con el emulador de windows Wine, instala el Internet Explorer… ¡Si! y pasamos a tener el Internet Explorer como una aplicación más de nuestro escritorio. Además permite instalar varias versiones: la 5, la 5.5, la 6 y la 7 (esta última en beta y no va bien)… y permite tener varias de éstas instaladas ¡a la vez! y así probar un mismo sitio web en distintas versiones de Explorer. Además se puede instalar sin ser root… ¿que más se puede pedir?

Bueno, para los linuxeros, no puedo hacer más que recomendaros encarecidamente el IES4Linux.


Documental: Revolution OS

Este es un interesante documental del 2001 sobre el nacimiento del Linux, GNU, la FSF y el movimiento del software libre en general. Más que recomendable para los que hemos abrazado la filosofía del pingüino y los que quieran saber más sobre este apasionante mundo. El vídeo dura 1h y 25 minutos (preparad el sillón) y está en inglés, pero es muy claro y fácil de comprender (vamos, que hasta yo lo entiendo), no obstante, también lo hay subtitulado en Stage6.