background preloader

A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux

A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux
(or, "Size Is Everything") She studied it carefully for about 15 minutes. Finally, she spoke. "There's something written on here," she said, frowning, "but it's really teensy." [Dave Barry, "The Columnist's Caper"] If you're a programmer who's become fed up with software bloat, then may you find herein the perfect antidote. This document explores methods for squeezing excess bytes out of simple programs. Please note that the information and examples given here are, for the most part, specific to ELF executables on a Linux platform running under an Intel-386 architecture. Please also note that if you aren't a little bit familiar with assembly code, you may find parts of this document sort of hard to follow. In order to start, we need a program. Let's take an incredibly simple program, one that does nothing but return a number back to the operating system. So, here is our first version: /* tiny.c */ int main(void) { return 42; } which we can compile and test like so: $ gcc -Wall tiny.c $ . So.

SimpleRip: Ripping/Encoding DVDs to Xvid with Mencoder | quadpoint.org This page generates the necessary commands to encode a movie directly from a DVD title to an Xvid file using MEncoder without the need for other applications or helper scripts. (mencoder commands will magically appear here) Options Source file This is the input file to read. This will typically be where 1 is the DVD title to rip. Output file This is the .AVI file that results when the encoding is complete. Audio and video bitrates For movies, 128kbps for audio is typically plenty. Volume gain Value from -10 to 10. Process nice Value from -20 to 19. Crop Cropping is necessary to remove the black borders at the top and bottom of widescreen-format DVDs, and scaling will resize the output video to a smaller pixel by pixel area, resulting in increased quality. Mplayer can automatically detect the crop settings. The format for this option is W:H:X:Y, where: Cropped width and height. Position of the cropped picture. Scale This option is complicated. Passes Value: 1 or 2. Extra options -ss <time>

Optimization in GCC In this article, we explore the optimization levels provided by the GCC compiler toolchain, including the specific optimizations provided in each. We also identify optimizations that require explicit specifications, including some with architecture dependencies. This discussion focuses on the 3.2.2 version of gcc (released February 2003), but it also applies to the current release, 3.3.2. Let's first look at how GCC categorizes optimizations and how a developer can control which are used and, sometimes more important, which are not. The purpose of the first level of optimization is to produce an optimized image in a short amount of time. gcc -O1 -o test test.c Any optimization can be enabled outside of any level simply by specifying its name with the -f prefix, as: gcc -fdefer-pop -o test test.c We also could enable level 1 optimization and then disable any particular optimization using the -fno- prefix, like this: gcc -O1 -fno-defer-pop -o test test.c gcc -O2 -o test test.c

Understanding /proc Linux article When it comes down to it, /proc is a filesystem. Although it does not represent any physical device, you can still mount it and unmount it as you please. It contains a multitude of valuable information regarding the processes you are running, as well as the hardware you have hooked up to your computer (although in recent years, /sys has been devised by the Kernel folks to represent the hardware hierarchy and export device information ). You can see which modules you have loaded, how long your system has been up, and the memory usage of processes on your system. In fact, every single process running has an entry, or directory, inside /proc. Note: Many of the examples in this guide require root access to work correctly. {mospagebreak title=Mounting /proc} As mentioned earlier, /proc is a filesystem. Most systems have /proc mounted by default in /etc/fstab, but just in case, make sure that it's mounted by doing: $ mount If the output contains a line such as: proc on /proc type proc (rw)

Designing for Performance - Rico Mariani's Performance Tidbits I wrote this article back in July and it ended up being the basis of this video (scroll to where it says “Thinking about Performance” and choose a speed) I was going to have the article edited and published seperately but somehow that never happened, so here it is now... the content isn't terribly new but it's kinda handy to have some of it in written form. Designing for Performance I’m a “performance guy”. I think this article is a reaction to hearing the phrase “Premature Optimization is the root of all evil” one time too many. Now, please don’t get me wrong. You see, the danger of that “Premature Optimization…” phrase is that it encourages good engineers to not think about performance until far too late in their development cycle and they have a really swell sounding reason to not do it. “This is never going to work. If things have gone really badly then a team with a poor performing solution is going to have to do some major rewriting, even complete rewriting. Honest. So what to do?

ELC: How much memory are applications really using? [Posted April 18, 2007 by corbet] Anybody who has tried to figure out why a Linux system is running short of memory can attest that the memory usage information made available by the kernel is, at best, difficult to use. Matt Mackall has recently been working on a set of patches aimed at improving this situation. Matt pointed out that the currently-available information is confusing at best. The problem is that the numbers exported by the current kernels are nearly meaningless. The Linux virtual memory system, in other words, is a black box which provides too little information on what is going on inside. The first step is to add a new file (pagemap) in each process's /proc directory. Then, there is a file (/proc/kpagemap) which provides information about the kernel's memory map. Once this information is available, one can start to generate some useful numbers on memory use. (Log in to post comments)

efficiency - C++ ctors: What's the point of using initializer list in a .cpp file Direct Folders - quick access to your favorite folders Code Sector Web blog.codesector.com Official blog with product news, updates and events droidsector.com Android devices database: wiki, specs, reviews, links soundmaven.com Music aggregator of the latest news, videos, photos, bios, reviews and more Direct Folders guarantees you quick and direct access to your favorite and recent folders. One of the many useful features of Direct Folders is its ability to automatically switch the folder view of open dialogs to thumbnails, list or details depending on the application you are working with. How Direct Folders works There are several ways to access Direct Folders. Select a favorite or recent folder from this menu and the file dialog immediately jumps to that folder. Direct Folders actions when the file dialog opens: Resizes the file dialog box. The ClickSwitch feature will make a file dialog instantly jump to the folder already opened in Explorer, Total Commander or Directory Opus. Direct Folders Pro * * 30-Day Money Back Guarantee Live demo

c++ - Does the restrict keyword provide significant anti-aliasing benefits in gcc / g++ Optimizing C++/Optimization life cycle The construction of an efficient application should adhere to the following development process: This development process follows two criteria: Principle of diminishing returns. Optimizations that yield big results with little effort should be applied first, as this minimizes the time needed to reach the performance goals.Principle of diminishing portability. It is better to apply optimizations applicable to several platforms first, as they remain applicable on changing platform and are more understandable to other programmers. In the rare case of software that must be used with several compilers and several operating systems but just one processor architecture, the stages 4.5 and 4.6 should be swapped. This stage sequence is not meant to be a one-way sequence, in which once one stage is reached, the preceding stage is no longer used. This book is about only three of the above stages: Arrays, structs, and class instances are objects which, if not empty, contain sub-objects.

Related: