デスクトップ機 : 自作
CPU : DualCore-Celeron G530
GPU : Intel HD Graphics
SSD : Crucial m4 CT064M4SSD2
ラップトップ機 : Thinkpad x121e
CPU : AMD E-450
GPU : Radeon HD 6320 (CPU内蔵)
HDD : 2.5inch 5400 rpm
コンパイル対象
簡単というかhello world
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
void main(){ | |
writeln("Hello, world!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
int main(void){ | |
std::cout << "Hello, world!" << std::endl; | |
return 0; | |
} |
結果
デスクトップ
$ time dmd hello.d
real 0m0.259s
user 0m0.208s
sys 0m0.044s
$ time g++ hello.cpp
real 0m0.240s
user 0m0.192s
sys 0m0.028s
ラップトップ
$ time dmd hello.d
real 0m1.084s
user 0m0.960s
sys 0m0.116s
$ time g++ hello.cpp
real 0m1.144s
user 0m1.016s
sys 0m0.112s
正直C++とDの両方を用意する意味はあまり無かった気が。
いくら遅いとはいえHello worldで1秒待たされるというのは……
0 件のコメント:
コメントを投稿