Debian armel vs. Raspian

Auf dem Raspi läuft ja in aller Regel Raspian. Debian armel nutzt die SoftABI und ist nicht auf den Raspberry Pi optimiert aber hat andere Vorteile.

Hier mal eine Gegenüberstellung meiner bisherigen Erkenntnisse zu Rasbian und Debian armel:

Merkmal Raspbian Debian armel
ABI hard float soft float
Compileroptimierung armv6+vfp2 armv4t
Installation auf Raspberry Pi Image ziehen, unzip, dd und go qemu in Image, Austausch des Kernels und der Module, dd und go

Security Updates

Raspian

Keine verlässliche Information. Laut irc Protokoll soll praktisch alles innerhalb kurzer Zeit was bei wheezy einläuft auch in Raspian eintrudeln. Hier die Quellen: http://plugwash.raspbian.org/logs/index.php?date=2013-01-05 ab [2:45]

Hier aber das Wiki zum Rasbian Installer:

wiki: ‘Raspbian Installer’ hat geschrieben:

Configure the package manager The repository on security.debian.org couldn’t be accessed, so its updates will not be made available to you at this time. You should investigate this later.

Debian armel

Security Updates werden sicher von Debian zu Verfügung gestellt

Versuche

Nachdem ich mir Debian armel installiert hatte lief Debian wie gewohnt. Um zu testen wie sich diese ABI auswirkt, hab ich folgendes kleines Programm geschrieben:

/*
test program to compare ABIs on Raspberry Pi
Copyright (C) 2013 Georg Gast

This file is part of int-fpu-test.

int-fpu-test is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

int-fpu-test is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>

static const size_t array_size = 1000000;

int	g_int1[array_size];
int	g_int2[array_size];
int	g_int3[array_size];

float	g_float1[array_size];
float	g_float2[array_size];
float	g_float3[array_size];

double	g_double1[array_size];
double	g_double2[array_size];
double	g_double3[array_size];

size_t cycles = 1000;

struct MTime
{
	MTime(std::string s_name)
	:	ms_name(s_name)
	{
		std::time(&mt_start);
	}
	~MTime()
	{
		std::time(&mt_end);

		// print difftime
		std::cout << ms_name << ":\t" << std::difftime(mt_end, mt_start) << std::endl;
	}

	std::string ms_name;
	std::time_t	mt_start;
	std::time_t	mt_end;
};

void int_test()
{
	MTime stop_watch("Int Test");
	size_t i;

	for (size_t c = 0; c < cycles; ++c)
	{
		for (i = 0; i < array_size;++i)
			g_int3[i] = g_int1[i] + g_int2[i];

		for (i = 0; i < array_size;++i)
			g_int3[i] = g_int1[i] - g_int2[i];

		for (i = 0; i < array_size;++i)
			g_int3[i] = g_int1[i] * g_int2[i];

		for (i = 0; i < array_size;++i)
			g_int3[i] = g_int1[i] / g_int2[i];
	}
}
void float_test()
{
	MTime stop_watch("Float Test");
	size_t i;

	for (size_t c = 0; c < cycles; ++c)
	{
		for (i = 0; i < array_size;++i)
			g_float3[i] = g_float1[i] + g_float2[i];

		for (i = 0; i < array_size;++i)
			g_float3[i] = g_float1[i] - g_float2[i];

		for (i = 0; i < array_size;++i)
			g_float3[i] = g_float1[i] * g_float2[i];

		for (i = 0; i < array_size;++i)
			g_float3[i] = g_float1[i] / g_float2[i];
	}
}
void double_test()
{
	MTime stop_watch("Double Test");
	size_t i;

	for (size_t c = 0; c < cycles; ++c)
	{
		for (i = 0; i < array_size;++i)
			g_double3[i] = g_double1[i] + g_double2[i];

		for (i = 0; i < array_size;++i)
			g_double3[i] = g_double1[i] - g_double2[i];

		for (i = 0; i < array_size;++i)
			g_double3[i] = g_double1[i] * g_double2[i];

		for (i = 0; i < array_size;++i)
			g_double3[i] = g_double1[i] / g_double2[i];
	}
}

int main(int argc, char** argv)
{
	// init random numbers
	std::srand(std::time(NULL));

	{
		MTime stop_watch("Init Arrays");

		// prepare arrays
		for (size_t i = 0; i < array_size; ++i)
		{
			g_int1[i] = std::rand();
			g_int2[i] = std::rand();

			g_float1[i] = std::rand();
			g_float2[i] = std::rand();

			g_double1[i] = std::rand();
			g_double2[i] = std::rand();

			// prevent div by zero
			g_int2[i]++;
			g_float2[i]++;
			g_double2[i]++;
		}
	}

	if (argc >=2)
		cycles = std::atoi(argv[1]);

	std::cout << "Running " << cycles << " Cycles ..." << std::endl;

	// run the tests
	int_test();
	float_test();
	double_test();
}

Ein Cycle ist 1Mio mal die Addition/Subtraktion/Multiplikation/Division zweier int/float/double Werte. Alle Werte sind im Speicher.

Alle Ergebnisse sind in Sekunden.

Raspian nutzt GCC 4.6.3 Ergebnisse Raspbian:

./src/int-fpu-test 100
Init Arrays:    2
Running 100 Cycles ...
Int Test:       38
Float Test:     38
Double Test:    51

Debian armel nutzt ebenfalls GCC 4.6.3 Ergebnisse Debian armel:

./src/int-fpu-test 100
Init Arrays:    3
Running 100 Cycles ...
Int Test:       39
Float Test:     78
Double Test:    171

Wie man sieht ist die Intleistung praktisch gleich, aber die Float und Double Leistung ist unglaublich in den Keller gegangen. float = 2.05x armhf und double = 3.35x armhf.

Das ganze hier ist für mich eine zusammenfassung von https://debianforum.de/forum/viewtopic.php?f=15&t=142626