DragonFly BSD
DragonFly commits List (threaded) for 2005-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/kern imgact_elf.c init_main.c kern_checkpoint.c kern_descrip.c kern_event.c sys_generic.c sys_pipe.c uipc_syscalls.c uipc_usrreq.c vfs_aio.c vfs_syscalls.c src/sys/sys filedesc.h src/sys/dev/misc/streams streams.c ...


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Jun 2005 10:43:44 -0700 (PDT)

:can anybody enlighten me why this was done in the first place?
:this way it's much clearer anyways
:
:cheers
:  simon

    To be clean.  The original code was designed to be optimal for,
    um, VAX computers at the cost of being considerably less readable
    by using a array of pointers (scaling factor x4 for the array lookup)
    for the most common operation (a file pointer lookup).  The second
    array of chars to store the file flags (scaling factor x1 for the array
    lookup), in order to avoid a structure of 6 bytes and having to do a
    multiply by 6 to look up an entry in the array.  Back then space was
    at a premium.

    Now we have a file pointer (4 bytes), flags (1 bytes), and allocation
    count (4 bytes) = 9 bytes.  Since space is not at a premium I just made
    it 12 bytes and a multiply is used for the array lookup.

    If we care more about performance we could make it 16 bytes so the array
    lookup is scaled by a factor of two again, which I might just do actually
    because that removes the overhead of a multiply.

					-Matt



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]