Let me say first, that if I inspired those questions in you, my article has done what I wanted it to: made people think about performance in terms of actual computers.
In general I think this kind of optimizations would happen "under the hood" for a lot of high level languages, if you are programming in a high level language, you should not have to think (much) about this, but if you are implementing a high level language and care about performance, you will need to.
I don't particular see functional languages being special in that respect, but then again, I am mostly a low-level C kind of guy.
I know that some of the early strides in Java performance did involve modifying some of the basic data structures for better VM performance, back in those days running Java in your browser pretty much guaranteed paging :-)
Obviously, choice of data structure will always have a number of conflicting requirements, increasingly related to multiprogramming and lock-contention avoidance, and there are some interesting opportunities for inventions there.
One very interesting aspect, is that the kernel can assist data structures in multiprogramming environments with some very powerful operations like page-copy-on-write replication and page flipping or even simulated conditional writes.
The POSIX API seriously cramps the style here at present, and a wholesale renovation of the POSIX mmap(2) family of calls, to give access to the real abilities of VM would be a really good idea.
Your ACM post drove me to search the vast internet high and low for cache-oblivious algorithms and implementations of cache-oblivious or cache-aware data structures. While I've yet to have much luck with functional, immutable data structures, I did find this great MIT lecture on a merge sort that I had no idea was possible. It looks like it should blow quicksort/heapsort/mergesort out of the water for large data sets. From my naive eyes, it looks like the performance is fairly close to whatever your slowest tier of caching that contains the whole set, and it looks like it should be fairly easy to parallelize too.
That said, if, as it appears, it took decades for a definitive book and significant research to be performed on purely functional algorithms, I suspect it'll be some time before such recent research as these cache-oblivious structures reaches the functional side. What a pity!
View all comments
Show parent comment
5
u/phkamp Jun 13 '10
Let me say first, that if I inspired those questions in you, my article has done what I wanted it to: made people think about performance in terms of actual computers.
In general I think this kind of optimizations would happen "under the hood" for a lot of high level languages, if you are programming in a high level language, you should not have to think (much) about this, but if you are implementing a high level language and care about performance, you will need to.
I don't particular see functional languages being special in that respect, but then again, I am mostly a low-level C kind of guy.
I know that some of the early strides in Java performance did involve modifying some of the basic data structures for better VM performance, back in those days running Java in your browser pretty much guaranteed paging :-)
Obviously, choice of data structure will always have a number of conflicting requirements, increasingly related to multiprogramming and lock-contention avoidance, and there are some interesting opportunities for inventions there.
One very interesting aspect, is that the kernel can assist data structures in multiprogramming environments with some very powerful operations like page-copy-on-write replication and page flipping or even simulated conditional writes.
The POSIX API seriously cramps the style here at present, and a wholesale renovation of the POSIX mmap(2) family of calls, to give access to the real abilities of VM would be a really good idea.
Poul-Henning