This is a speculative guess, but your code works with the disk and disk I/O, and I am going to assume that this is your bottleneck - you mentioned that it runs faster on the machine with 500GB flash storage than on the one with 250 GB flash storage - this makes sense, logically, because of how flash storage is essentially a raid-0 of smaller (32/64gb) flash storage chips, and more chips/disks in a raid-0 array will greatly increase performance. I do not know the particular make/model/firmware/controller of the storage, however I suspect that if you were to do a disk I/O test, you would find a similar discrepancy in performance on the two machines. Such a performance test can best be done using XBench.
Почему код на С ++ работает на одном компьютере значительно дольше, чем на другом?
Код точно такой же - я скопировал его с одного компьютера на другой. Код скомпилирован с g ++ - 4 (4.9.1), полученным из fink на OSX на обеих машинах, и не запускается параллельно.
Параметры компилятора - «-O2», и компьютеры в основном ничего не делают (низкое использование процессора и памяти). Код представляет собой ссылку на код исследования в 2400 строк .
Машина 1:
- MacBook Pro Retina в конце 2013 года,
- 2,8 ГГц i7-4558U,
- 16 ГБ 1600 МГц DDR3,
- 500 ГБ флэш-памяти
Машина 2:
- Рабочая станция MacPro в конце 2013 года,
- 3,5-ГГц 6-ядерный Intel Xeon E5-1650,
- 32 ГБ 1867 МГц DDR3
- 251 ГБ флэш-памяти,
- Внешний накопитель SATA емкостью 3 ТБ
Время работы:
Машина 1: с выходной мощностью 200 сек., Без 18 сек.
Машина 2: (/ каталог - должна быть флешка): с 2230 сек., Без 2075 сек.
Машина 2: (~ каталог - должен быть внешний диск): с 2262 сек., Без 2080 сек.
Есть идеи, как улучшить время выполнения на MacPro?
2 ответа на вопрос
The proper way to approach the question "why does this code take so long to run", whether "long" is in absolute or relative terms, is to use a tool called a profiler.
Basically, you run the program through the profiler or with the profiler attached, and the profiler records how much time the program spends in various functions. This information is then presented to you in a form that allows you to pinpoint the parts of the program that took the longest to run during that execution. Often it will also be possible to get additional information from that report, such as which parts of the program are called the largest number of times, and things like that, which can also point toward areas that could use some scrutiny.
Based on that data, it's usually easy to tell which parts need to be optimized such that the program runs faster, without employing the guessing game known as "premature optimization" or relying on the particulars of some specific piece of hardware.
Похожие вопросы
-
3
Ускорение загрузки OS X на годичной MBP
-
3
Как повторно связать резервную копию Airport Time Machine после перехода на новый Mac?
-
6
Как вы отключите звук запуска на Mac?
-
-
5
Почему мой Macbook сильно нагревается при использовании Boot Camp?
-
7
Есть ли в Mac OS X эквивалент Ctrl + Tab?
-
6
Способ переноса данных Time Machine на новый диск
-
13
Сброс положения Mac OS X Windows после отсоединения внешнего монитора
-
10
Программное обеспечение для резервного копирования для Mac OS X
-
5
Как удалить и удалить .kext в Mac OS X?
-
4
Как переназначить клавишу извлечения на клавиатуре MacBook, чтобы «удалить»?