如何写快(低电平)code? [英] How to write fast (low level) code?

查看:99
本文介绍了如何写快(低电平)code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更多地了解低水平code优化,以及如何采取底层机器架构的优势。我期待的就在哪里读到这个话题很好的指针。

I would like to learn more about low level code optimization, and how to take advantage of the underlying machine architecture. I am looking for good pointers on where to read about this topic.

更多细节:

我在科学计算领域感兴趣的优化(这是很多数字运算,但的不仅的)处于较低水平的语言,如C / C ++。我特别感兴趣的优化方法,这些方法并不明显,除非一个人如何机的工作原理有很好的理解(我不---还)。

I am interested in optimization in the context of scientific computing (which is a lot of number crunching but not only) in low level languages such as C/C++. I am in particular interested in optimization methods that are not obvious unless one has a good understanding of how the machine works (which I don't---yet).

例如,很显然,一个更好的算法比较快,不知道有关它的运行的计算机的任何信息。如果一个循环通过柱或一个矩阵的行首先它不是在所有明显的是它的问题。 (这是通过基质更好地循环,以便存储在相邻的位置的元素被依次读出。)

For example, it's clear that a better algorithm is faster, without knowing anything about the machine it's run on. It's not at all obvious that it matters if one loops through the columns or the rows of a matrix first. (It's better to loop through the matrix so that elements that are stored at adjacent locations are read successively.)

在主题或指向文章的基本意见是最欢迎的。

Basic advice on the topic or pointers to articles are most welcome.

答案

得到的答案有很多伟大的指针,很多比我什么时候有时间阅读。这里的所有的人的名单:

Got answers with lots of great pointers, a lot more than I'll ever have time to read. Here's a list of all of them:

  • The software optimization cookbook from Intel (book)
  • What every programmer should know about memory (pdf book)
  • Write Great Code, Volume 2: Thinking Low-Level, Writing High-Level (book)
  • Software optimization resources by Agner Fog (five detailed pdf manuals)

我需要一点时间脱脂来决定使用(没有时间全部)其中之一。

I'll need a bit of skim time to decide which one to use (not having time for all).

推荐答案

Drepper的什么每个程序员应该知道内存[PDF] 是一个很好的参考,以低级别优化的一个方面。

Drepper's What Every Programmer Should Know About Memory [pdf] is a good reference to one aspect of low-level optimisation.

这篇关于如何写快(低电平)code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆