Speeding up small programs
The use of small functions that do specific jobs well is an important way to make flexibility. However, one of the troubles of working with such small programs the efficiency loss that is accompanied by having pipelines that write to memory. There are a few sources:
As to how this will fix many of our problems, in the same order:
Here is an interesting similar idea to mine. They use a functional language with precompiled functions. Type checking is done and then the precompiled programs are literally stitched next to each other. This provides the best of both worlds. It is called Esther. It is fast because it involves no interpretation nor compilation. That makes it possibly faster than c in terms of compiling (^^), and faster than hugs in terms of running (^^).
- Program instantiation is much slower than function calls - the OS has to create new thread space, allocate/page memory
- Programs need to pass information, and the only way would be to either write to a shared memory space, or something that emulates such a space (e.g. a temporary file etc)
- Programs might need specific information, and discard the rest of the information, thus making it a waste to compute all the information.
- Programs that run on a list of inputs would need to be instantiated for each element of the list
- Programs might be called several times for the same information, and optimisations that rely on repeated program calls cannot be made
- Programs that I am proposing do not do any variety of input/output. They are very much just processing boxes hexagon architecture. They will all have to use the same input/output "ports".
- Function calls are fast, as long as they are to the same block of memory.
- Functions that are compiled can use registers to store information. Reading/writing to register is faster than to memory, and avoids caching problems.
- Functions can have callback hooks
- Functions can be designed to have input-output loops. Also, the coder could recognise which variables need to be reset to starting values.
- Functions results can be stored, and the way the function responds can be individually optimised
- Functions can do anything - i.e. they are not restricted in any way. That means that they can be optimised for whatever they are doing.
- work at a bytecode level
- lazyness, ranging from extreme to novice (explained later)
- fusion
- stitching
- a program that takes a file, and gives a file of the same structure, but with different information in some places, and you know exactly what places the information will be different in. for example a program that changes an element in an array.
- you can ask for a specific set of information at (almost) no overhead cost. for example a program that will tell you the value of an element in an array.
- you can ask for information in a linear way. for example a program that will give running sums of an array, a fibonacci function.
- you can only ask for all the information. for example floyd's algorithm.
As to how this will fix many of our problems, in the same order:
- Program are stitched together in one space
- Shared information are handled via lazyness, and since we are using information querying, it is possible to store the results of each query in registers or in smaller temporary memory areas
- Lazyness removes problems of discarded information. What does not need to be discarded will not
- It is possible for the bytecode to be high level enough (like J functions are), to be automatically ranked, and thus work on lists without extra manipulation
- Memoising bytecode? (doubtful)
Here is an interesting similar idea to mine. They use a functional language with precompiled functions. Type checking is done and then the precompiled programs are literally stitched next to each other. This provides the best of both worlds. It is called Esther. It is fast because it involves no interpretation nor compilation. That makes it possibly faster than c in terms of compiling (^^), and faster than hugs in terms of running (^^).
2 Comments:
At Wednesday, July 19, 2006 , Anonymous said...
This comment has been removed by a blog administrator.
At Thursday, July 20, 2006 , Anonymous said...
This comment has been removed by a blog administrator.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home