
What happens when you page align everything - inopinatus
http://adrianchadd.blogspot.com/2015/03/cache-line-aliasing-2-or-what-happens.html
======
acqq
Introductionary link, with everything you need to know before you read this
blog post:

[https://github.com/erikarn/himenobmtxpa](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.

------
erikarn
... turns out the #1 feedback was "that blog template sucks."

yes, it does. So I just flipped back to "simple" for now. Ugh.

~~~
dang
[http://en.wikipedia.org/wiki/Parkinson%27s_law_of_triviality](http://en.wikipedia.org/wiki/Parkinson%27s_law_of_triviality)

Please continue writing solid technical posts.

------
dvh
Ok, I guess not everything is about CSS :)

~~~
alfonsodev
hehe, indeed I thought it was. "The TL;DR is this - there's some hardware
inside the Intel CPUs that tracks memory ordering and cache contents - but
they don't use all the address bits."

------
Confusion
Somewhere in the past few months I read a blog post where the author showed
how even the same code, compiled and executed on the same machine, could show
significantly different performance between compiles. Does anyone have a
reference to that post?

~~~
Someone
Likely
[https://homes.cs.washington.edu/~bornholt/post/performance-e...](https://homes.cs.washington.edu/~bornholt/post/performance-
evaluation.html) (*"Even more terrifying than linking order is a result in
this paper that shows how the size of your UNIX environment variables biases
performance")

~~~
Confusion
That was what I was looking for, thanks!

------
evook
There's literally tabula rasa for everyone blocking scripts...

------
aw3c2
World's worst blog design strikes again with its mandatory Javascript and
annoying layout. Here is a static copy:
[https://archive.today/uvbua](https://archive.today/uvbua)

~~~
Already__Taken
In a similar vein. Can we please never use `text-align: justify;` it might as
well be called `hard-to-read: dyslexics`

~~~
frankzinger
I always wondered why people don't use text-align: justify more often. Is this
really a reason? What about all the books out there? Why are Web pages
different?

(I get the feeling I am missing something obvious.)

~~~
bradleyland
Experience: One of my primary clients when I ran an agency for 7 years was a
book publishers.

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'?

~~~
Already__Taken
I assume justifying text is to primarily maximise the amount of text on the
paper to make a cheaper book. It shouldn't even exist on the web.

~~~
wtbob
Justification doesn't change the amount of text on the paper; it spreads out
lines which would otherwise have a ragged right edge (in left-to-right
languages) so that the text has a visually appealing right edge. It's done to
look good, and succeeds. But it requires work to do right.

~~~
joshuapants
> Justification doesn't change the amount of text on the paper

You can fit more characters per line in a justified layout.

> It's done to look good, and succeeds. But it requires work to do right.

Absolutely, but well executed left-alignment can also look good, and in a
format where you don't necessarily have control over the size of the page
_and_ the time to properly justify the text it should be preferred. IMO, left-
alignment beats poorly justified text every time.

~~~
wtbob
> You can fit more characters per line in a justified layout.

Ummm, justification is about adding space to spread a line out: it's
impossible to fit more text on a line that way.

Kerning is about removing space. It's related to by independent of
justification. A well-laid-out work will do both.

> Absolutely, but well executed left-alignment can also look good

Meh. For printed material I think it's worth the effort to justify.

> in a format where you don't necessarily have control over the size of the
> page and the time to properly justify the text it should be preferred. IMO,
> left-alignment beats poorly justified text every time.

No argument there.

~~~
cauterized
Typically a paragraph of justified text (at least in most word processors) has
some lines that are uncomfortably compressed and others that are uncomfortably
spread out.

------
AuntTillie
"Premature optimization is the root of all evil" \-- Donald Knuth

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.

~~~
StefanKarpinski
I'm so tired of people trotting this quote out. We get it – _you_ don't care
about performance – hardware is fast and your problems are easy. But there are
people who have difficult problems to solve – some hard enough that the limits
of what hardware can do represent a real constraint. For those people, having
a deep understanding of hardware and performance is essential.

~~~
dang
I couldn't agree more. It is the most pre-fab of dismissals and takes threads
like this in precisely the wrong direction: into generic goo, when we ought to
be discussing salient details, like the impact of varying page alignments.

Few of us have anything substantive to say about that, which is fine—but then
we ought to post nothing, not regurgitate truisms.

