December 2019 Commit Log

Number of Commits:
3
Number of Active Developers:
2
partmedia 2019-12-29 22:12 Rev.: 21076

Refactor; remove notes about performance

There is probably no performance benefit from reducing the number of
calls to mapdata_cell(). However, this particular change made the code
more readable, so keep this change. I refactored the scope of the new
temporary MapCell variables.

I compared the assembly of the old code with the new code. I used clang
8.0.1 with -O2 on FreeBSD/amd64. In both versions, the assembly has
mapdata_cell() inlined and lifted out of the inner loop:

movq the_map(%rip), %r12
movslq %edi, %r13
movslq %esi, %rax
imulq $152, %rax, %r15
movq (%r12,%r13,8), %rdi
addq %r15, %rdi

Even though the old code has multiple calls and the new code has an
intermediate variable, both generated the same code! Notice how the
result of "calling" mapdata_cell() is never stored in memory; it stays
in a register.

In general, in the age of deep pipelines, large caches, and speculative
execution, even comparing assembly is generally not enough. However,
when both versions produce the same assembly, it's a pretty convincing
argument that there is no performance benefit.

There are plenty of inefficiencies hanging around in the client, for
example, the unnecessary double-buffering in Pixmap mode, that when
fixed would produce a measurable performance benefit. But trying to
outsmart the compiler probably isn't going to do much.

3 lines of code changed in 2 files:

silvernexus 2019-12-29 19:47 Rev.: 21074

Reduce calls to mapdata_cell

19 lines of code changed in 2 files:

partmedia 2019-12-25 07:51 Rev.: 21057

Bump version string to 1.74.0

4 lines of code changed in 2 files:

November 2019 »

Generated by StatSVN 0.7.0