58 points · by inopinatus · 11y ago · 53 comments
https://github.com/erikarn/himenobmtxpa
(This benchmark) "shows a dramatic difference in behaviour between Linux and FreeBSD/DragonflyBSD (and likely other BSDs.) It turns out that most of the difference is due to memory layout by the allocator. The matrices are large, and jemalloc page aligns these. So there's significant cache line aliasing effects."
The blog article author measured then the speed of the above benchmark adding different offsets, and gave some useful links.
Best read not on the original blog site (ugly javascript dependency and moving wheels, I do hope such technologies get to be avoided) but on the link given by aw3c2 here.
yes, it does. So I just flipped back to "simple" for now. Ugh.
Please continue writing solid technical posts.
I don't mean to pick on you personally, or just on this one comment. (Your second sentence alone, by the way, would have been a helpful contribution.) The problem is the tedious stampedes such comments spawn.
Maybe a "offtopic" or "noise" flag could be used for punishing comments like this (similarly to random comments that praise a submission without adding anything) so they float down but not into the grey negative score area?
Then open the file in your browser of choice.
Here is one quick dirty way using only shell, sed, nc and the openssl binary:
https://news.ycombinator.com/item?id=7367156
Example:
Copy and paste the script into a file and save as some filename.
Then
filename adrianchadd > f.html
browsername f.html
It is still an annoyance to have to do this; I wholeheartedly agree with your comment.Mandatory JavaScript delenda est!
You don't need JS to display HTML text. Browsers have had that ability since Berners-Lee.
(I get the feeling I am missing something obvious.)
You'd fall over if you saw the subtlety of the tools and the amount of effort that goes in to typesetting a book with justified body text. It is not at all unusual for a publisher to employ staff specifically for the task of typesetting. In the final stages of book production, the typesetters are assigned sections of the book after all edits are complete (ha! in a perfect world), at which point they meticulously review each page of text, often manually inserting/removing hyphenation, until the text is laid out correctly.
Care to venture a guess at the number of bloggers who do the same when using 'text-align: justify'?
Another thing is that, actually, design has come a long way and many modern websites look way better than many older books.
Edit: Yep, totally forgot about hyphenation. I guess I haven't seen hyphenated text in a long time, as everything in web is unhyphenated.
What works for i386 may not be applicable on arm/hppa/ppc/etc. It should not even matter these days as almost every CPU clocks well over 1000MHz. If that is still not enough, extra cloud instances are probably cheaper than wasting your time with extensive profiling and manual optimizations.
Few of us have anything substantive to say about that, which is fine—but then we ought to post nothing, not regurgitate truisms.
L1 caches for most modern CPUs work in this manner, and you see the same result. (Wikipedia has a description - http://en.wikipedia.org/wiki/CPU_cache - the type of cache commonly employed today being the N-way set associative type.) You can run the same calculations to get an equivalent value for each CPU. For example, you asked about HPPA: for a PA8700, this value would - I suppose... I just found the cache specification using Google :) - be 384KBytes, as its data cache is 1.5MBytes 4-way set associative.
As a more general note: If you try to seriously solve performance problems, you'll quickly find, as I always have, that there's little basis in reality for the idea that they can be fixed late in the day with a few spot hacks. Indeed, that idea is usually the reason the problems have arisen in the first place.
But that idea has to be the basis of any doctrine of adopting a just-in-time policy for performance problems! So if you're not a big fan of programming with performance in mind, then I do think you should be celebrating this kind of quick tweak, rather than decrying it. It's evidence for your position.
As for mindset, page aligned allocations are required to use protection modes and I tend to program more with security in mind. Glad it helps performance, but it could often times be a completely unintentional side effect. Thanks for your insights, though. Appreciated!
^: Assuming they're at present in idle (or off) state.
Donald Knuth was clearly for optimizing software, he merely said that you should profile before you optimize. The author is clearly profiling his code, and there's nothing wrong with getting more out of the hardware you paid for.
At least profiling showed the author why page aligning all the things is silly. I have yet to work on an architecture where it isn't at best a waste of time, so I'm not sure why the measurement was necessary, but hey—running the test cured a potential delusion.
I also have yet to work on a system that can talk over the network faster than it can to another core that shares a layer of cache with it.
Besides, hardware savings are multiplied over all your customers—it's only 1:1 if you're working on software for a single entity. If that's your case, then you're probably right—any time on making quality software is probably wasted because few will benefit, and hardware probably is cheaper than dev time. That's not the world everyone lives in, though.
There just wasn't enough CPU bandwidth to handle very much processing. So the first version tried to be quite fast. But it turned out that it gave false positives as well as false negatives. No shipping of that sucker. I made up a rule for performance-critical software: "First, make it right, then make it fast".
I am curious what about the article suggests that the optimization is premature? Do you mean to say that one should never worry about optimization?