521 karma · joined June 19, 2008
Another good emacs guide that I came across recently is:
http://m00natic.github.io/emacs/emacs-wiki.html
Additional resources I found helpful:
http://www.emacswiki.org/emacs/EmacsNiftyTricks
http://web.psung.name/emacstips/essential.html
Plus, check out the videos from Magnar Sveen's emacs rocks:
There is an interesting comment that illustrates the distinction between US/Europe education systems by observing that in Europe high schools are general followed by focused specific subject studies, whereas in the US there is a lot of focusing already happening in the high schools. Interestingly, though, there seems to be a general education requirement for an undergraduate degree; since I am from Europe this seems to have the purpose of ensuring that all admitted students get to the same level before specializing.
https://en.wikipedia.org/wiki/Buddy_memory_allocation
Unfortunately, the article is not a very good explanation, I remember having seen a drawing of the data structure, but cannot recall from where...
edit:
It turns out that the mentioned jemalloc internally uses buddy lists as well.
[1] http://repository.readscheme.org/ftp/papers/plsemantics/reyn...
There were several novel research ideas tried for the Oberon system. I remember there was some paper called "Active Text" that allowed putting videos into code comments. (Probably that could have been done in Smalltalk, too.)
Finally, all of the books explaining details are heartily recommended. Wirth's compiler book (referred to at HN several times) is a classic easy-going introduction (the Oberon-0 grammar fits on only two pages IIRC! [1]), his algorithm book (also available for download, also referred to multiple times at HN) has some of the nicest descriptions that I did not find anywhere else (showing a divide-and-conquer approach to computing the median [near the Quicksort treatment]; plus polyphase sort, which might be useful again in data centers), and finally the Project Oberon book contains some unique treatment on system software that is not easily found anywhere else. For example, it contains the details on what's called PieceLinkText, which is the (at least AFAIK) best data structure to implement a text editor and it's operations. (Predating rope-strings by a fair amount of time, too.)
edit:
[1]: just checked my own copy; Oberon-0's grammar actually fits on one page, the full Oberon grammar fits on two pages!
[2]: URLs:
- Compiler book: http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf
- Algorithm book: http://www.inf.ethz.ch/personal/wirth/books/AlgorithmE1/AD20...
- Project Oberon: http://www.inf.ethz.ch/personal/wirth/books/ProjectOberon.pd...
I also do agree with the other comment regarding funding agencies. Another problematic way that NSF does business (inviting professors for peer review that is) is that this virtually guarantees that some of your peers know exactly what you're doing, which reduces effectiveness of double-blind submissions substantially (to the point where it is hard to believe it works at all; didn't it ever occur strange to anyone that the same people from the same top schools are consistently successful? [with grants and publications in the top venues])
What I actually wanted to know, what the biggest application is, i.e., a not benchmark.
ad 3) I am well aware of that. However, I remember that at PLDI'11 there was a talk from Univ. of Edinburgh chaps doing parallel trace-based dynamic binary translation. Obviously, DBT is less work than a high level, full-blown JIT, but at least it's not nil :)
The issue with benchmarks is surely well known, also by the PyPy authors; I wonder what the biggest application is that they have benchmarked or that runs on PyPy.
Your point on the JIT compiler interrupting program execution is certainly valid, too, but not necessarily so. One could easily do the code generation in a separate background thread and let execution switch over only if necessary. But, as you have already said, a latency issue certainly exists. This is one of the cases where interpreters usually have a leg up, and there are promising ways of optimizing interpreters.
Mathematics: Form and Function by Saunders Mac Lane. This is one of my favorite books concerning the "build-up" of mathematics (it also contains nice diagrams of "relatedness" of subjects). On HN somebody once recommended Mathematics: Its contents, methods, and meaning (from Russian mathematicians in the 50s) which is similar but without the cross references.
Proofs and Refutations by Imre Lakatos. I have started reading this only recently and have to say that I find the approach and idea excellent. It would be great if we had something comparable for CS theory as well.
Notes on Introductory Combinatorics by Polya, Tarjan, and Woods. Have not read this exhaustively, but the introduction with Pascal's triangle and some of Polya' legendary problem solving insights (paraphrased from my memory: "you are on to something once you find a pattern") are definitely highlights in this book.
Mathematical Discovery: On Understanding, Learning and Teaching Problem Solving by George Polya. Based on the previous book and my fond memories of reading "How to Solve it", I got this one from the library. Again I can't attest for all of the contents, but AFAICT now it's another gem from Polya.
From HN advice in previous years I read The Tibetan Book on Living and Dying, which I can heartily recommend, too. It is an anti-thesis to Christian theology and I find it to contain many insightful comments and different views on leading a good, meaningful life. I disagree with some of the church-y comments on that it really is important to have a master and that only the master can do certain things, but that's probably just me being an atheist all along.
I actually read some other books, but the list is already kind of long and might hold interesting pointers for other mathematically inclined readers, too. I for one am always fascinated on how much advice on problem solving in mathematics translates to CS.
http://www.cse.chalmers.se/research/group/logic/TypesSS05/Ex... (also covers typed lambda calculus AFAIR)
There is also an interesting video of Dijkstra from a Netherland's television station (http://www.cs.utexas.edu/~EWD/video-audio/NoorderlichtVideo....)
There are some fun quotations of him about APL and Basic.
To get the "logic of science" part, you also need to have (IMHO) some fairly decent grasp of combinatorics, for which I quite recently stumbled upon one of the best books in this field: "Notes on Introductory to Combinatorics." (I like the links to many of Polya's gems of "How to solve it.")
For many other references, a quick HN search for publicly available references will result in other endorsements, too (a preliminary version of the Jaynes' book used to be available, too)
Regarding the threaded code: the literature seems to be horribly inconsistent in this regard. Token threaded code might actually refer to indirect-threaded code depending on what the author has read. I was actually quite surprised to read what "indirect threaded code" originally meant when I read Debaere and van Campenhout's 1990 book "Interpretation and Instruction Path co-processing".
Regarding the effect of CSE & tail-merging: I have only seen GCC to do this once, by disabling basic block reordering (-fno-reorder-blocks, due to a so-called "software trace cache"), otherwise this has never happened to me. Since I have nothing but the highest respect for Mike Pall, I guess that he might have experienced this for Lua, which has--to the best of my knowledge--less than 40 instructions. I will try to verify this on the weekend.
Even though the potential is not going to be as big as for Java, Forth, and OCaml interpreters (where people frequently report 2x speedups), for example Python gains between 20 and 45%. But somebody already replied to a similar inquiry and said that ANSI C compatibility is more important than the increase in performance. (Python uses conditional compilation to achieve both.)
I think a trace-JIT still gives you a lot of bang for the buck and is (in theory at least) easier to implement. Two known projects using trace-compilation are LuaJIT2 (usually well known) and Dalvik VM's JIT compiler (not so well known, needed to watch the Google I/O 2010 announcement.)
1) A stack-based ISA is still more space-compact. (AFAIR the Shi et al. paper mentions something like a 40+% increase in space requirement for the instructions.)
2) The performance improvement of a register-based ISA is only visible for interpreters that suffer most from instruction dispatch [1]. PHP is a rather complex programming language that is most certainly not bound by instruction dispatch at all. So I guess it could very well make sense to stick with a simple stack-based ISA, which incidentally is also easier to compile from the AST.
[1] for the sake of completeness: the stack architecture emits many instructions to push operands onto the operand stack. A register-based interpreter does not need those. Hence, the overall number of dispatches is lower, and if dispatch cost is your bottleneck the overall performance increases. OTOH, you need more space, because in addition to the opcodes, you need to specify/encode which registers to take operands from and put results to. (Hint: quadruple code and the likes.)
Probably the de facto fastest interpreter is the one of the Sun HotSpot Java virtual machines. There is a paper by Robert Griesemer detailing some information, but AFAIR it is a hand-coded optimized assembly interpreter that does not too bad. LuaJIT's interpreter is doing quite well, too. (Mike Pall said in the LTU thread about trace-based compilation that the LuaJIT2 interpreter is mostly on par with the LuaJIT1 compiler, or at least not much slower.)
EDIT: replaced "LuaJIT1 interpreter" with more accurate compiler as pointed out by haberman.
- Linux's perf tool allows you to read HW performance counters. It's pretty self-explanatory, and some interesting ones are platform-neutral, whereas others you have to specify the CPU manufacturer's hex-code. (See Intel manual, for example.)
- For pipelining and HW/CPU details, I suggest you grab a copy of Hennesy and Patterson's Computer Architecture: A Quantitative Approach. There is also Computer Architecture: A Programmer's Perspective, which is good, but I think for what you're interested in, CAAQA is the better book.
- If you just want to play around with HW performance counters, you might want to try Intel's vtune, which comes (or at least did so, two years ago) as an Eclipse plugin/RCP-workbench.
While agree with your primary criticism, I think the principle of locality applies well to this problem. While there are 24 million places (supposedly, never checked that from the paper), I'm positive that most maps queries are served to the areas with higher population density. Therefore, it might make sense to use the look-up table approach for densly populated areas to reduce the search time. (OTOH, the computer scientist in me reminds me that the 7ms might pale in comparison to latency times for mobile phones receiving the map information...)
Just for the record: I recently read (presumably on HN, too) about a ranking where somebody asked lawyers to rank schools according to their prestige. Penn-State always got ranked in the middle, even though it didn't have a law school at all. So, in a sense it doesn't even matter if administrators are cheating or not...
The original lambda papers might be on your want-to-read list, too: http://library.readscheme.org/page1.html; I liked the AIM-453 TR, "The Art of the Interpreter, or, The Modularity Complex" by G. Steele and G. Sussman.
It would be nice if there were comparable benchmark results available, or a discussion of what is different between both approaches/implementations.
EDIT: bb link didn't work, replaced it with ACM portal link.