Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to make linux "FASTER"

  1. #1
    Senior Member comtux's Avatar
    Join Date
    Sep 2004
    Location
    Wilkes Barre Pa
    Posts
    342

    How to make linux "FASTER"

    Ok everyone i have slacked on my posting so lets get them make linux faster tips rolling in here.


    Making Mozilla's Firefox "FASTER"
    Here's something for broadband people that will really speed Firefox up:

    1. Type "about:config" into the address bar and hit return. Scroll down and look for the following entries:

    network.http.pipelining
    network.http.proxy.pipelining
    network.http.pipelining.maxrequests

    Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.

    2. Alter the entries as follows:
    Right click on the entries to edit.

    Set "network.http.pipelining" to "true"

    Set "network.http.proxy.pipelining" to "true"

    Set "network.http.pipelining.maxrequests" to some number like 30. This means it will make 30 requests at once.

    3. Lastly right-click anywhere and select New-> Integer. Name it "nglayout.initialpaint.delay" and set its value to "0". This value is the amount of time the browser waits before it acts on information it recieves.

    If you're using a broadband connection you'll load pages 2-3 times faster now.

  2. #2
    Senior Member comtux's Avatar
    Join Date
    Sep 2004
    Location
    Wilkes Barre Pa
    Posts
    342

    Re: How to make linux "FASTER"

    ELF Prelinking and what it can do for you
    By: James Crasta
    http://www.crast.us/james/articles/prelink.php


    What is Prelinking?
    Prelinking is a process that allows you to speed up the process of dynamic linking. What it does is, through a process of magic that is incredibly complex, but basically it speeds up the relocation process, in loading shared libraries.. by setting preferred load addresses.

    What is he talking about, you ask? Well, here's how it goes. Dynamically linked libraries (often referred to as DSO's or in the windows world DLLs) are libraries which are loaded at runtime. The advantage of shared libraries versus static libraries is, that it reduces the size of executables, since each program doesn't need its libraries built in, but will dynamically locate and use it at run time. This adds some overhead, because the address space of the library, instead of being known in advance, has to be mapped at runtime. Another advantage of shared libraries is that due to the magic of copy-on-write, you can save memory when you have multiple programs sharing the same library (though it's not as simple as that.. it is pretty complicated)

    Pre-linking sets preferred address space for the libraries to be loaded at. Note they are _preferred_ spaces, and if that address space is not available, then it will use relocation to load it dynamically.. hence pre-linking is not 100% foolproof.

    What do I need to prelink?
    To prelink, you need at least:
    - glibc 2.3.1 or greater
    - libelf or elfutils 0.7, though 0.8 is preferred. Latest version as of this writing is 0.84
    - Your shared libraries have to be compiled with -fPIC
    - the prelink program from ftp://people.redhat.com/jakub/prelink

    Okay, so now how do I do it?
    First, you need to set up a prelink.conf . This file tells prelink where to search for shared libraries and where to search for apps to prelink if you decide to use the -a feature to prelink everything.

    # /etc/prelink.conf
    -l /bin
    -l /sbin
    -l /usr/bin
    -l /usr/sbin
    -l /lib
    -l /usr/lib
    -h /usr/local/lib
    -h /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1
    -h /usr/lib/mozilla
    -h /usr/X11R6/lib

    once you have set this up, you are ready to go.
    to prelink an executable, simply:

    # prelink /path/to/executable

    (note that the path must be an absolute path to the program)
    The process of prelinking is reversible, to remove the prelinking simply:

    # prelink --undo /path/to/executable

    These other flags might also be useful to you:
    -v verbose, will show all the libraries it is linking
    -n dry run, when used with v will compute libraries but not modify any executables
    -a Prelinks _all_ executables using a recursive search of the directories in prelink.conf

    I wanna see numbers! Does it really help?
    Well, the results with prelinking is mixed. I haven't seen any tests where prelinking hurt execution speed, but while some people get spectacular improvements, some people get only minimal improvements. I've combined data from my tests on mozilla and konqueror, along with Jekub Jelinek's tests on konqueror, to see how much elf prelinking really helps.
    Tests Without Prelink With Prelink Notes
    Mozilla test 1 real 0m1.199s
    user 0m0.160s
    sys 0m0.020s real 0m1.133s
    user 0m0.110s
    sys 0m0.020s This test was done by running mozilla with DISPLAY= set to nothing. basically, it just tests the prelinking stage, not the loading and connecting to the X server.
    Mozilla test 2 real 0m7.582s
    user 0m2.160s
    sys 0m0.180s real 0m7.556s
    user 0m2.210s
    sys 0m0.100s This test was done from the start to finish of mozilla load, with me exiting as soon as mozilla loaded up. It is not really an accurate test since user speed also is a factor here.. but to me (the user) I saw no perceived difference between using prelink and not using it.
    Konqueror test real 0m0.906s
    user 0m0.240s
    sys 0m0.020s real 0m0.923s
    user 0m0.020s
    sys 0m0.030s I tried the same with konqueror, another huge C++ app with lots of shared libraries, but it seems the time didn't change that much, except for a decent change in user time.. but not a huge difference. Jakub Jelinek seemed to get better results
    Jakub Jelinek's Konq test real 0m0.510s
    user 0m0.510s
    sys 0m0.000s real 0m0.011s
    user 0m0.000s
    sys 0m0.010s Jelinek seemed to get some really good results in loading konq... I don't know why I wasn't as lucky.

    In my tests with prelinking, I have been unable to get any sort of results with it. However, it may work better for you. I guess, the only thing to do is try it. The process is reversible at least. It won't work on just any system though, all the libraries have to be compiled with -fPIC and you need a recent glibc. A recently compiled gentoo will work with prelink enabled, you will have to kludge with other distros.

    To prelink or not to prelink?
    Prelink theoretically can cause large performance boosts. It avoids a lot of calls to mmap that have to be done in the dynamic linking process. On some systems and with very large programs that load a lot of shared libraries, prelinking in tests has shown speed increases in load time. Keep in note, however, that prelinking only really helps the load time of your applications, for the most part actual runtime speed is not affected.

    also note that, in order for prelink to be useful, you need to have all your libraries compiled with fPIC, and be running glibc 2.3.1 or higher. I don't know if this is the case for the major distributions, aside from Gentoo which does support prelinking if you have a recently compiled gentoo setup.

    The final word: if you have all the requirements to prelink, and really want to get that speed bost, it's worth a try. else, wait and see if it catches on enough that your distribution will begin prelinking executables for you.

    Sources:
    - GlibC 2.3 paper: changes in the new GlibC http://people.redhat.com/drepper/lt2002talk.pdf
    - Gentoo Linux Prelink Guide http://www.gentoo.org/doc/en/prelink-howto.xml

  3. #3
    Senior Member comtux's Avatar
    Join Date
    Sep 2004
    Location
    Wilkes Barre Pa
    Posts
    342

    Re: How to make linux "FASTER"

    And here is a little shell script to picks the optimal gcc options
    for x86 hardware.



    #!/bin/bash

    #This script is Linux specific
    #It should work on any gcc

    #these apply to any arch (just here for reference)
    unsafe_math_opts="-ffast-math -fno-math-errno -funsafe-math-optimizations -fno-trapping-math"

    gcc_version=`gcc -dumpversion | sed 's/\([0-9]\{1,\}\.[0-9]\{1,\}\)\.*\([0-9]\{1,\}\)\{0,1\}/\1\2/'`

    IFS=":"
    while read name value; do
    unset IFS
    name=`echo $name`
    value=`echo $value`
    IFS=":"
    if [ "$name" == "vendor_id" ]; then
    vendor_id="$value"
    elif [ "$name" == "cpu family" ]; then
    cpu_family="$value"
    elif [ "$name" == "model" ]; then
    cpu_model="$value"
    elif [ "$name" == "flags" ]; then
    flags="$value"
    fi
    done < /proc/cpuinfo
    unset IFS

    if [ "$vendor_id" == "AuthenticAMD" ]; then
    if [ "$cpu_family" == "4" ]; then
    _CFLAGS="$_CFLAGS -march=i486"
    elif [ "$cpu_family" == "5" ]; then
    if [ "$cpu_model" -lt "4" ]; then
    _CFLAGS="$_CFLAGS -march=pentium"
    elif [ "$cpu_model" == "6" ] || [ "$cpu_model" == "7" ]; then
    _CFLAGS="$_CFLAGS -march=k6"
    elif [ "$cpu_model" == "8" ] || [ "$cpu_model" == "12" ]; then
    if expr $gcc_version '>=' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=k6-2"
    else
    _CFLAGS="$_CFLAGS -march=k6"
    fi
    elif [ "$cpu_model" == "9" ] || [ "$cpu_model" == "13" ]; then
    if expr $gcc_version '>=' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=k6-3"
    else
    _CFLAGS="$_CFLAGS -march=k6"
    fi
    fi
    elif [ "$cpu_family" == "6" ]; then
    if [ "$cpu_model" -le "3" ]; then
    if expr $gcc_version '>=' 3.0 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=athlon"
    else
    _CFLAGS="$_CFLAGS -march=k6"
    fi
    elif [ "$cpu_model" == "4" ]; then
    if expr $gcc_version '>=' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=athlon-tbird"
    elif expr $gcc_version '>=' 3.0 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=athlon"
    else
    _CFLAGS="$_CFLAGS -march=k6"
    fi
    elif [ "$cpu_model" -ge "6" ]; then #athlon-{4,xp,mp}
    if expr $gcc_version '>=' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=athlon-xp"
    elif expr $gcc_version '>=' 3.0 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=athlon"
    else
    _CFLAGS="$_CFLAGS -march=k6"
    fi
    fi
    fi
    else #everything else "GenuineIntel"
    if [ "$cpu_family" == "3" ]; then
    _CFLAGS="$_CFLAGS -march=i386"
    elif [ "$cpu_family" == "4" ]; then
    _CFLAGS="$_CFLAGS -march=i486"
    elif [ "$cpu_family" == "5" ] && expr $gcc_version '<' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=pentium"
    elif [ "$cpu_family" -ge "6" ] && expr $gcc_version '<' 3.1 >/dev/null; then
    _CFLAGS="$_CFLAGS -march=pentiumpro"
    elif [ "$cpu_family" == "5" ]; then
    if [ "$cpu_model" != "4" ]; then
    _CFLAGS="$_CFLAGS -march=pentium"
    else
    _CFLAGS="$_CFLAGS -march=pentium-mmx" #No overlap with other vendors
    fi
    elif [ "$cpu_family" == "6" ]; then
    if echo "$flags" | grep -vq cmov; then #gcc incorrectly assumes i686 always has cmov
    _CFLAGS="$_CFLAGS -march=pentium -mcpu=pentiumpro" #VIA CPUs exhibit this
    else
    if [ "$cpu_model" == "0" ] || [ "$cpu_model" == "1" ]; then
    _CFLAGS="$_CFLAGS -march=pentiumpro"
    elif [ "$cpu_model" -ge "3" ] && [ "$cpu_model" -le "6" ]; then #4=TM5600 at least
    _CFLAGS="$_CFLAGS -march=pentium2"
    elif [ "$cpu_model" -ge "7" ] && [ "$cpu_model" -le "11" ]; then #9 invalid
    _CFLAGS="$_CFLAGS -march=pentium3"
    fi
    fi
    elif [ "$cpu_family" == "15" ]; then
    _CFLAGS="$_CFLAGS -march=pentium4"
    fi
    fi

    if expr $gcc_version '>=' 3.1 >/dev/null; then
    if echo "$flags" | grep -q sse2; then
    _CFLAGS="$_CFLAGS -mfpmath=sse -msse2"
    elif echo "$flags" | grep -q sse; then
    _CFLAGS="$_CFLAGS -mfpmath=sse -msse"
    fi
    if echo "$flags" | grep -q mmx; then
    _CFLAGS="$_CFLAGS -mmmx"
    fi
    if echo "$flags" | grep -q 3dnow; then
    _CFLAGS="$_CFLAGS -m3dnow"
    fi
    fi

    echo "$_CFLAGS"

  4. #4
    Guest
    This is the kind of stuff that should be submitted as KB Articles. Except for the fact that you don't do html.... :|

  5. #5
    Senior Member comtux's Avatar
    Join Date
    Sep 2004
    Location
    Wilkes Barre Pa
    Posts
    342
    In the /etc/profile.d/ folder I have created an executable make.sh file containing this:

    #!/bin/sh
    export CFLAGS="-march=athlon -O3 -finline-functions -falign-jumps=5 -falign-loops=5 -pipe -fomit-frame-pointer" &&
    export CXXFLAGS=${CFLAGS} &&
    export CPPFLAGS=${CFLAGS}

    Every time I login (any user) this file is parsed and the settings applied so when I run "make" I automatically get the compile settings for my system.
    Use this with the script above.
    The script above should tell you what the best optimization options for you pc.


    Ok everyone lady is getting pissed off i have to go to bed now ill post more latter.

  6. #6
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    Alrightee, I just submitted a KB article about a whole bunch of tweaks you can do to get Firefox faster. Hopefully Mark ok's it while this thread is still new. I will post a direct link as soon as its up.
    jro - http://jeff.robbins.ws
    Linux counter#:213782
    GnuPG ID: 406238E7

  7. #7
    Advisor
    Join Date
    Apr 2004
    Location
    orlando
    Posts
    608
    Quote Originally Posted by mcangeli";p="5046
    This is the kind of stuff that should be submitted as KB Articles. Except for the fact that you don't do html.... :|
    that's what <pre> tags are for

    EDIT:
    had to disable html

  8. #8
    Associate
    Join Date
    Nov 2004
    Location
    Birmingham UK
    Posts
    15
    lovely firefox tips

    made a lot of difference to browsing

    top banana!

  9. #9
    you should be careful when playing around with maxrequests and stuff like that in firefox. The higher the setting, the more load you give the server. So it's not smart to set it to anything higher than 6-8.

  10. #10
    Member
    Join Date
    Dec 2004
    Location
    Missing Mile
    Posts
    122

    Re: How to make linux "FASTER"

    on the tweaking firefox that is a great help and improves speed but theres also an extension in case you dont want to mess with about:config

    https://addons.update.mozilla.org/ex...id=327&vid=989

Similar Threads

  1. ndiswrapper help! (a/k/a "Make my eyes stop bleeding")
    By JoeyJoeJoe in forum Linux - Hardware, Networking & Security
    Replies: 11
    Last Post: 04-11-2007, 12:01 AM
  2. "groupadd" and "tree" utilities are nowhere??
    By aromes in forum Redhat / Fedora
    Replies: 1
    Last Post: 10-05-2003, 03:50 AM
  3. Replies: 0
    Last Post: 09-16-2003, 01:23 PM
  4. Using "make" with gklmsensors.
    By Backbiter in forum Linux - General Topics
    Replies: 5
    Last Post: 07-17-2002, 10:23 AM
  5. Xlib:  extension "GLX" missing on display ":0.0".
    By ph34r in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 12-06-2001, 04:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •