はじめに
こちらはDXライブラリ関数の時間計測の記事です。
各関数の処理時間を一覧にして掲載しています。
DXライブラリはこちらからダウンロードできます。
何か不備がありましたら指摘していただければ幸いです。
追記: コメントを頂き、"UpdateKey"と"UpdateKey2"のコード、計測結果を変更しました (2017/12/11)
ルール (決まりごと)
メインルール
100万回ループさせて計測する。
計測は10回行う。
計測結果の平均値を求める。
サブルール
線画の始点座標は(100,100)、終点座標は(300,300)とする。
中心点を指定する際は座標を(200,200)とする。
必要となる変数はその都度コメントアウトを外す。
環境
PC:HP Spectre x360 Convertible 13-ac0XX
CPU:Intel Corei7-7500U @ 2.70GHz 2.90GHz
RAM:16.0GB
ROM:SSD 512GB
IDE:VisualStudio Community 2017
cl; C/C++ Compiler 19.11
結果
名前 |
分類 |
時間(ミリ秒) |
GetPixel |
dxlib.h |
544872 |
DrawCircle(TRUE) |
dxlib.h |
22793.8 |
DrawCircleAA(TRUE) |
dxlib.h |
17483.2 |
DrawBoxAA(TRUE) |
dxlib.h |
16864.4 |
clsDx |
dxlib.h |
12893.7 |
DrawCircle(FALSE) |
dxlib.h |
12686.8 |
DrawCircleAA(FALSE) |
dxlib.h |
10445.5 |
DrawBoxAA(FALSE) |
dxlib.h |
8636.3 |
DrawLineAA |
dxlib.h |
7455.2 |
DrawFormatString3 |
dxlib.h |
7057.2 |
DrawRotaGraph(TRUE) |
dxlib.h |
6850.2 |
DrawTurnGraph(TRUE) |
dxlib.h |
6683.1 |
DrawTurnGraph(FALSE) |
dxlib.h |
6665.2 |
LoadGraph |
dxlib.h |
6655.7 |
DrawGraph(TRUE) |
dxlib.h |
6643.9 |
DrawModiGraph(TRUE) |
dxlib.h |
6641.6 |
DrawExtendGraph(TRUE) |
dxlib.h |
6637.3 |
DrawGraph(FALSE) |
dxlib.h |
6607 |
DrawBox(TRUE) |
dxlib.h |
5927.9 |
SRand |
dxlib.h |
2342.4 |
printfDx |
dxlib.h |
2054 |
DrawFormatString1 |
dxlib.h |
1730.6 |
DrawString |
dxlib.h |
1378.5 |
WaitTimer |
dxlib.h |
1000 |
DrawFormatString2 |
dxlib.h |
856.9 |
UpdateKey |
UpdateKey |
683 |
UpdateKey2 |
UpdateKey |
554.1 |
DrawBox(FALSE) |
dxlib.h |
441.3 |
CheckHitKeyAll |
dxlib.h |
385.2 |
DrawLine |
dxlib.h |
175.2 |
GetHitKeyStateAll |
dxlib.h |
119.7 |
DrawPixel |
dxlib.h |
61.9 |
CheckHitKey |
dxlib.h |
23.3 |
xor128 |
xor128 |
22.1 |
tan |
math.h |
18 |
cos |
math.h |
14.9 |
sin |
math.h |
14.2 |
GetRand |
dxlib.h |
11.9 |
GetJoypadInputState |
dxlib.h |
7 |
sqrt |
math.h |
6 |
GetColor |
dxlib.h |
4.9 |
GetJoypadNum |
dxlib.h |
4 |
GetTouchInputNum |
dxlib.h |
2 |
1000ミリ秒=1秒
精度は1ミリ秒程度ある。
コード
main.cpp
#include "DxLib.h"
#include <stdio.h>
#include <chrono>
//#include <math.h>
//横画面サイズ
#define MAP_X 400
//縦画面サイズ
#define MAP_Y 400
/*メイン関数*/
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
//log出力停止・ウィンドウモード変更・初期化・裏画面設定
SetOutApplicationLogValidFlag(FALSE), ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen(DX_SCREEN_BACK);
//画面サイズの決定
SetGraphMode(MAP_X, MAP_Y, 32);
//タイトル文字
SetMainWindowText("指定");
printfDx("名前 20XX年XX月XX日\n");
//データ保存先
FILE *fp;
errno_t error;
error = fopen_s(&fp, "指定.txt", "w");
if (!error) {
//char Buf[256];
//int Key[256] = { 0 };
//int Handle;
//int Handle = LoadGraph("picture.png");
//int intNumber = 0;
//double doubleNumber = 0;
//unsigned long ulomgNumber = 0;
//int intAfter = 0;
//int uintAfter = 0;
//double doubleAfter = 0;
//平均値
int ave = 0;
//計測時間(ミリ秒)
int timeMS;
//unsigned int White = GetColor(255, 255, 255);
std::chrono::system_clock::time_point start, end;
for (int j = 0; j < 10; j++) {
//intNumber = GetRand(999);
//doubleNumber = (double)GetRand(999);
//計測開始時間
start = std::chrono::system_clock::now();
for (int i = 0; i < 1000000; i++) {
//処理を書く
}
//計測終了時間
end = std::chrono::system_clock::now();
timeMS = (int)std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
ave += timeMS;
fprintf(fp, "%d\n", timeMS);
printfDx("%d:%d\n", j + 1, timeMS);
}
fclose(fp);
printfDx("平均:%d\n", ave / 10);
WaitKey();
}
//DXライブラリの終了処理
DxLib_End();
return 0;
}
図形描画関数
DrawLine(100, 100, 300, 300, White);
![1512854158044.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fe4b60fcd-9b8c-2cef-f18a-df52242d4b7a.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=99be7d6f62c7f537655f1d7b6da33183)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawLine |
188 |
173 |
174 |
173 |
173 |
175 |
174 |
175 |
173 |
174 |
175.2 |
DrawLineAA(100.0f, 100.0f, 300.0f, 300.0f, White);
![1512840767032.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Ffa6975e8-6233-5a6b-2e11-9a3cf5ebdb7d.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=ac9fcbcfd6638d78577dc8acadec3cea)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawLineAA |
7520 |
7443 |
7431 |
7443 |
7542 |
7399 |
7446 |
7479 |
7451 |
7398 |
7455.2 |
DrawBox(TRUE)
DrawBox(100, 100, 300, 300, White, TRUE);
![1512841269182.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F2a0ee995-35dd-42a5-488e-7195b1096fb5.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=df29ae789249ba9e87c205391eaf5f51)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawBox(TRUE) |
5932 |
5878 |
5987 |
5911 |
5901 |
5988 |
5916 |
5884 |
5984 |
5898 |
5927.9 |
DrawBox(FALSE)
DrawBox(100, 100, 300, 300, White, FALSE);
![1512841362770.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Ffdcf8c4a-05ee-5e77-0806-e9a0e331a121.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=ff1f0194206ff3a6cbc93b8b5518e06b)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawBox(FALSE) |
463 |
437 |
452 |
438 |
437 |
437 |
437 |
438 |
438 |
436 |
441.3 |
DrawBoxAA(TRUE)
DrawBoxAA(100.0f, 100.0f, 300.0f, 300.0f, White, TRUE);
![1512841747187.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fae3c5cec-a4fa-ab31-afa1-a48230f75cd5.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=aa33f7b819185e40b75bb13de78daa77)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawBoxAA(TRUE) |
16798 |
16732 |
16834 |
16805 |
16946 |
16829 |
17055 |
16823 |
17028 |
16794 |
16864.4 |
DrawBoxAA(FALSE)
DrawBoxAA(100.0f, 100.0f, 300.0f, 300.0f, White, FALSE);
![1512841987388.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F580a4661-cf52-7c32-3f75-7f79f9c30241.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=2bedce08e06f5583b427e5a8461d3a25)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawBoxAA(FALSE) |
8843 |
8681 |
8344 |
8329 |
8624 |
8839 |
8755 |
8843 |
8544 |
8561 |
8636.3 |
DrawCircle(TRUE)
DrawCircle(200, 200, 100, White, TRUE);
![1512842426931.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fc3af394c-e842-f34d-8c39-1bb17401f9e3.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=ed8964e5f575781d548bd54e7ba58456)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawCircle(TRUE) |
22691 |
22638 |
22649 |
22800 |
22718 |
22745 |
22863 |
22755 |
22827 |
23252 |
22793.8 |
DrawCircle(FALSE)
DrawCircle(200, 200, 100, White, FALSE);
![1512842684947.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fc7e739b3-413e-80df-163d-ebb858943f92.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=658beb2eb4e7e2f6ce5579ef523215c6)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawCircle(FALSE) |
12788 |
12732 |
12687 |
12683 |
12665 |
12650 |
12681 |
12638 |
12656 |
12688 |
12686.8 |
DrawCircleAA(TRUE)
DrawCircleAA(200.0f, 200.0f, 100.0f, 32, White, TRUE);
![1512974736652.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F0e59fdf6-e9ea-eff1-3a3d-8b70a622355d.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=4d571ff3d3c1405751deffe026815f86)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawCircleAA(TRUE) |
17335 |
17646 |
17352 |
17342 |
17327 |
17261 |
17802 |
17390 |
17948 |
17429 |
17483.2 |
DrawCircleAA(FALSE)
DrawCircleAA(200.0f, 200.0f, 100.0f, 32, White, FALSE);
![1512974908945.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F995b812e-d2df-585a-75a2-bd6ab0c68998.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=bf3188125111468b5ddf43fff2ee834d)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawCircleAA(FALSE) |
9983 |
10375 |
10598 |
10481 |
10633 |
10369 |
10504 |
10537 |
10513 |
10462 |
10445.5 |
DrawPixel(200, 200, White);
![1512847783479.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F7479d279-bae5-c699-22a1-63e3251328ae.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=b8cb6b1b7c9fdcc090e03404b0edf31b)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawPixel |
73 |
75 |
57 |
60 |
57 |
61 |
57 |
61 |
57 |
61 |
61.9 |
uintAfter = GetPixel(200, 200);
![1512860108581.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fbfa5837e-bc56-5733-80af-1f77a6b6dec5.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=2b4af58acd8cdc93b173ceb9182512e8)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetPixel |
525144 |
512430 |
516162 |
518323 |
525807 |
568150 |
571016 |
572251 |
574383 |
565054 |
544872 |
その他画面操作系関数
White = GetColor(255, 255, 255);
![1512975013432.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F0ffd04b4-f378-fc77-7dbe-688569ab605c.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=2e9a0a8547c3ab18481f3e699c980e13)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetColor |
5 |
5 |
4 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
4.9 |
乱数取得関数
intAfter = GetRand(intNumber);
![1512844546870.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F9e2663a2-0b2e-8955-e7a8-11b61d8a413f.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=20d0d99188320e2fc8af2cfbb398cb15)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetRand |
9 |
9 |
9 |
9 |
9 |
9 |
9 |
41 |
9 |
6 |
11.9 |
intAfter = SRand(intNumber);
![1512844659888.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F92dee7ec-8344-590b-d947-04aec9f2e63a.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=521b25def1dc1361319ec456e47de0b9)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
SRand |
2443 |
2329 |
2330 |
2332 |
2334 |
2328 |
2335 |
2333 |
2333 |
2327 |
2342.4 |
文字描画関係関数
DrawString(100, 100, "HelloWorld", White);
![1512844931836.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F1d2f9fbc-707b-df5b-0f8a-ab4009d45c32.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=e0edc09403c0d02eabb2e009dd34c66b)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawString |
1495 |
1363 |
1366 |
1367 |
1363 |
1362 |
1364 |
1370 |
1365 |
1370 |
1378.5 |
DrawFormatString1
DrawFormatString(100, 100, White, "HelloWorld");
![1512845521442.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fe3f7495d-d073-20ec-2e9a-29e2ab23026d.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=debe38db489c7891d8dea03ca944aa79)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawFormatString1 |
1856 |
1716 |
1718 |
1721 |
1714 |
1716 |
1714 |
1718 |
1715 |
1718 |
1730.6 |
DrawFormatString2
DrawFormatString(100, 100, White, "%d", intNumber);
![1512845715333.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Ffbff38ca-1a3d-206a-cc0b-cafce661e6b0.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=6f0f64454d90454678fe016a4e9ae2f7)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawFormatString2 |
1065 |
883 |
708 |
816 |
821 |
863 |
864 |
819 |
865 |
865 |
856.9 |
DrawFormatString3
DrawFormatString(100, 100, White, "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorld");
![1512845921590.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F4864281d-f26f-83d5-873b-d37d1eb994d6.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8cbe6ca71d1532dc2b243a4657ab7f0b)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawFormatString3 |
7181 |
7014 |
7035 |
7061 |
7039 |
7059 |
7029 |
7047 |
7049 |
7058 |
7057.2 |
簡易画面出力関数
![1512847302175.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F519d7e3f-d8e1-326d-749a-2670f3e24fd7.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=e23e1c27db4184f3f13f0fd825a55544)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
printfDx |
2157 |
2042 |
2040 |
2040 |
2049 |
2045 |
2043 |
2041 |
2040 |
2043 |
2054 |
![1512846224716.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F602bbd99-72fe-e389-247a-71a715cca6aa.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=7305431e133ca4136eeee83316944889)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
clsDx |
13009 |
12920 |
12876 |
12894 |
12877 |
12874 |
12875 |
12858 |
12886 |
12868 |
12893.7 |
ウエイト関係の関数
![1512847569640.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F137b54a3-d003-a171-5d82-73c1d0b84821.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=6767781d34fcf4ab88bb2a7a08d1702f)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
WaitTimer |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
1000 |
グラフィックデータ制御関数
Handle = LoadGraph("picture.png");
![1512848321492.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F38bfc13c-b01d-f0fc-fdb1-d5efdd33af12.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=5e183cc5a6f6aa203b04b2ee7f801878)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
LoadGraph |
53258 |
1481 |
1479 |
1478 |
1479 |
1478 |
1478 |
1471 |
1478 |
1477 |
6655.7 |
DrawGraph(TRUE)
DrawGraph(100, 100, Handle, TRUE);
![1512848572526.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fb404c5a6-bab5-a487-d67e-f2bf6663b14d.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=9aaf7b39fa659bb709c72eaebf9fa701)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawGraph(TRUE) |
6624 |
6616 |
6688 |
6613 |
6612 |
6701 |
6639 |
6587 |
6728 |
6631 |
6643.9 |
DrawGraph(FALSE)
DrawGraph(100, 100, Handle, FALSE);
![1512848722690.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F28f57d1f-803e-afbc-fa9d-1854b9e10f61.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=2e1bb7aa138dffbe970dd5b3710c7643)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawGraph(FALSE) |
6564 |
6525 |
6610 |
6528 |
6526 |
6608 |
6613 |
6669 |
6737 |
6690 |
6607 |
DrawTurnGraph(TRUE)
DrawTurnGraph(100, 100, Handle, TRUE);
![1512849312262.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F355f4dad-9f7d-0153-ab5f-2e4a49ce384a.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=aaa68dfa77351ee5693854a5af25341b)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawTurnGraph(TRUE) |
6695 |
6653 |
6744 |
6663 |
6660 |
6738 |
6632 |
6624 |
6759 |
6663 |
6683.1 |
DrawTurnGraph(FALSE)
DrawTurnGraph(100, 100, Handle, FALSE);
![1512849500338.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fb6b8153e-a7a8-305b-9c92-b18e1bbd21e9.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8d28349a4023b504c41ad1f1588be944)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawTurnGraph(FALSE) |
6600 |
6558 |
6643 |
6555 |
6555 |
6637 |
6629 |
6952 |
6789 |
6734 |
6665.2 |
DrawExtendGraph(TRUE)
DrawExtendGraph(100, 100, 300, 300, Handle, TRUE);
![1512849923632.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F48c7b86b-26ac-8a3f-4ef4-1b46e1fe7fe2.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8ca513a99862cd13dc728b1700cd1c85)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawExtendGraph(TRUE) |
6623 |
6580 |
6665 |
6584 |
6631 |
6668 |
6585 |
6602 |
6786 |
6649 |
6637.3 |
DrawRotaGraph(TRUE)
DrawRotaGraph(200, 200, 1.0f, doubleNumber, Handle, TRUE);
![1512850218793.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fbf0243d4-2d07-a613-31a3-b29e01d7bb7b.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=ec8086f98fd999ac94ab4595cf0c03ac)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawRotaGraph(TRUE) |
6792 |
6754 |
6816 |
6813 |
6790 |
6854 |
6842 |
6918 |
6987 |
6936 |
6850.2 |
DrawModiGraph(TRUE)
DrawModiGraph(100, 100, 300, 100, 300, 300, 100, 300, Handle, TRUE);
![1512850711612.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fa53489cf-4b0e-c7d8-8cf1-43a7ecb385d8.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=58724b5ce0f1e21a4562d964d9695566)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
DrawModiGraph(TRUE) |
6625 |
6596 |
6678 |
6603 |
6600 |
6685 |
6606 |
6605 |
6756 |
6662 |
6641.6 |
キーボード入力関連関数
intAfter = CheckHitKeyAll();
![1512851014123.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F4c69d3ac-9ab4-5337-08ec-78a3b83db6aa.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=d67bf4d1b97134c5c985ef9ddabd2339)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
CheckHitKeyAll |
413 |
363 |
543 |
383 |
360 |
358 |
359 |
357 |
358 |
358 |
385.2 |
intAfter = CheckHitKey(KEY_INPUT_ESCAPE);
![1512851190583.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F82b9ee8d-d495-1350-5159-f9597a18e3a9.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=cf7f134b9e24736665dee16880281b4d)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
CheckHitKey |
25 |
26 |
27 |
43 |
22 |
18 |
18 |
18 |
18 |
18 |
23.3 |
![1512851417970.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F48b4f4fa-01f5-04ea-1f08-c5a0462bbfa8.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=3ac23ec44b3e6a8bacbebde7228258a7)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetHitKeyStateAll |
188 |
107 |
111 |
108 |
107 |
107 |
107 |
107 |
125 |
130 |
119.7 |
ジョイパッド入力関連関数
intAfter = GetJoypadNum();
![1512851879076.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F2941cca1-61ae-1ff7-d71d-ff97303e2307.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=3fe31ea447e7083c53a9cb5d08b6825c)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetJoypadNum |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
intAfter = GetJoypadInputState(DX_INPUT_PAD1);
![1512851606845.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2Fe46f9793-e948-af18-ec2f-8fc57c6045e7.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=01d568376ab9fc8929e1e94d7a0b89ee)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetJoypadInputState |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
タッチパネル入力関連関数
intAfter = GetTouchInputNum();
![1512851985179.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F1abb3eac-c77a-02f0-807e-ef1168f6ff8c.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=c5abe41a37ee789bdc3e62ecc92e2b40)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
GetTouchInputNum |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
DXライブラリ以外の関数
xor128
unsigned long xor128() {
static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 886751230;
unsigned long t = (x ^ (x << 11));
x = y; y = z; z = w;
return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
xor128 |
25 |
25 |
25 |
40 |
19 |
18 |
17 |
17 |
17 |
18 |
22.1 |
UpdateKey
UpdateKey1
int Key[256] = { 0 };
int UpdateKey() {
char Buf[256];
GetHitKeyStateAll(Buf);
for (int i = 0; i < 256; i++) {
if (Buf[i]) {
if (Key[i] != std::numeric_limits<int>::max()) Key[i]++;
}
else {
Key[i] = 0;
}
}
return 0;
}
![1512972639309.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F49611f3b-f4ef-417b-476d-83babb0625c6.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=1fdbce39e381950128813ea581cadb76)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
UpdateKey1 |
745 |
678 |
675 |
677 |
675 |
675 |
675 |
677 |
674 |
679 |
683 |
UpdateKey2
int UpdateKey2(int *Key) {
char Buf[256];
GetHitKeyStateAll(Buf);
for (int i = 0; i < 256; i++) {
if (Buf[i]) {
if (Key[i] != std::numeric_limits<int>::max()) Key[i]++;
}
else {
Key[i] = 0;
}
}
return 0;
}
![1512972769292.jpg](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F213065%2F74ca8b8e-7e79-704e-bc7b-e416c20cd238.jpeg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=1e6c866414fecad64cd51154af583028)
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
UpdateKey2 |
626 |
570 |
542 |
543 |
545 |
542 |
542 |
544 |
542 |
545 |
554.1 |
math.h関数
sin
doubleAfter = sin(doubleNumber);
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
sin |
15 |
15 |
15 |
13 |
34 |
16 |
12 |
7 |
8 |
7 |
14.2 |
cos
doubleAfter = cos(doubleNumber);
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
cos |
13 |
13 |
14 |
14 |
13 |
45 |
11 |
9 |
9 |
8 |
14.9 |
tan
doubleAfter = tan(doubleNumber);
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
tan |
20 |
25 |
20 |
39 |
20 |
13 |
10 |
13 |
10 |
10 |
18 |
sqrt
doubleAfter = sqrt(doubleNumber);
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
平均 |
sqrt |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
ソースコードのライセンス
These codes are licensed under CC0.
![CC0 CC0](https://qiita-user-contents.imgix.net/https%3A%2F%2Fmirrors.creativecommons.org%2Fpresskit%2Fbuttons%2F88x31%2Fsvg%2Fcc-zero.svg?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=07c5d23efa2652b1eea90921ae9c0712)
ソースコードは自由に使用してください。
参考
DXライブラリ 関数リファレンスページ
新・C言語 ~ゲームプログラミングの館
C++でフリープラットフォームな時間計測