[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[WitchTech 00163] Re: ちょっとしたベンチマーク



 川俣です。

> > 偶数/奇数アドレスへのジャンプ(分岐)をベンチマークで比べても
> > 面白いかも。:-)
> > even が結構重要だったり。
> 
> どうでしょう?
> カートリッジバスが8bit幅なようなので、変わらない気がしますが。
 やっと時間取れたので、ちょっとベンチマーク。
 コードセグメント(FLASHメモリ?)、データセグメント(SRAM)、スタックセグメ
ント(IRAM)のデータのreadをテスト。

処理内容	秒数	秒数マイナスNULL LOOP処理時間
NULL LOOP	5

FLASH?
16bit even	32	27
16bit odd	36	31
8bit		33	28

SRAM
16bit even	42	37
16bit odd	42	37
8bit		36	31

IRAM
16bit even	32	27
16bit odd	36	31
8bit		32	27

 むむむ!?
 FLASH? MEMORYの数値が、ちょっと期待した数値と違いますね。
 奇数アドレス時だけ遅くなるのは、16bit接続されている証拠!?
 アクセス速度的には、IRAMと同程度のようですね。一度IRAMに転送してからア
クセスしても速くなりそうにないですね。

--------------makefile---------------------
# start up routine
C0WW_JAPANESE2=..\common\c0wwjpn2.obj

C0WW=$(C0WW_JAPANESE2)

LIBWW=@..\common\libww.rsp

CFLAGS=-ms -zPCGROUP -zSDGROUP -zGDGROUP -w -r-

all:	b003.fx

b003.fx:	b003.bin
	mkfent b003.cf

b003.bin:	b003.obj
	tlink /m /c $(C0WW) b003, b003, b003, $(LIBWW)
	exe2fbin b003.exe b003.bin

b003.obj:	b003.c
	tcc -c $(CFLAGS) $(DEFINES) -IC:\vshare\ww\dev\WWitch\include b003.c

--------------b003.c-----------------------
#include <stdio.h>
#include <sys/bios.h>
#include <il_sound.h>

#define COUNT (1000000L)

datetime_t from, to;
SoundIL soundIL;

extern BYTE *_heap;

typedef struct {
	char dummy;
	int oddData;
} ODD_DATA;

void beep(void)
{
	if(open_sound_il(&soundIL) != E_FS_SUCCESS) {
                /* ドライバが存在しない */
                return;
        }

        sounddrv_init();                    /* ドライバ用ワークの確保 */
        sound_open();                       /* HBLANK割り込みを開始 */

        parse_mml(_heap, "CDEFG", 0);       /* ヒープ領域へ演奏データを
格納 */
        bgm_play(_heap, 0);         /* 演奏開始 */
        key_wait();

        sound_close();                      /* HBLANK割り込み停止 */
        sounddrv_release();                 /* ドライバ用ワークの開放 */
}

void dump( char far * msg, datetime_t far * from, datetime_t far * to )
{
	int n;
	static char buf[256];
	text_screen_init();
	n = (to->minute*60+to->second)-(from->minute*60+from->second);
	sprintf( buf, "%d sec", n );
	text_put_string(0,0,msg);
	text_put_string(0,1,buf);
	/*key_wait();*/
	beep();
}

void main(int argc, char *argv[])
{
	long l;
	unsigned int codeSegment, dataSegment, stackSegment;
	unsigned char far * ptr8;
	unsigned int  far * ptr16;
	unsigned char dummy8;
	unsigned int dummy16;
	codeSegment = _CS;
	dataSegment = _DS;
	stackSegment = _SS;

	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
	}
	rtc_get_datetime_struct( &to );
	dump( "NULL LOOP", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)codeSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "FLASH 16bit even", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)codeSegment << 16L)+1L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "FLASH 16bit odd", &from, &to );

	ptr8 = (unsigned char far *)(((unsigned long)codeSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
	}
	rtc_get_datetime_struct( &to );
	dump( "FLASH 8bit", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)dataSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "SRAM 16bit even", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)dataSegment << 16L)+1L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "SRAM 16bit odd", &from, &to );

	ptr8 = (unsigned char far *)(((unsigned long)dataSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
	}
	rtc_get_datetime_struct( &to );
	dump( "SRAM 8bit", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)stackSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "IRAM 16bit even", &from, &to );

	ptr16 = (unsigned int far *)(((unsigned long)stackSegment << 16L)+1L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
		dummy16 = *ptr16;
	}
	rtc_get_datetime_struct( &to );
	dump( "IRAM 16bit odd", &from, &to );

	ptr8 = (unsigned char far *)(((unsigned long)stackSegment << 16L)+0L);
	rtc_get_datetime_struct( &from );
	for( l=0L; l<COUNT; l++ ) {
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
		dummy8 = *ptr8;
	}
	rtc_get_datetime_struct( &to );
	dump( "IRAM 8bit", &from, &to );

}

(株)ピーデー 川俣 晶 (http://www.autumn.org/ mailto:autumn@piedey.co.jp)



ML Archives