perftest.jc

来自「The JILRunOnly project is a simple comma」· JC 代码 · 共 41 行

JC
41
字号

/*
 *	perftest.jc
 *
 *	A simple performance test. Counts 10 times from 0 to 1.000.000 and takes average time.
 */

/*
 *	Import Typelibs
 */

import stdlib;

/*
 *	function main
 */

function float main()
{
    long i;
    long j;
    long startTime;
    long duration;
    float durationF;

    stdlib::Print("Performance test: Count 10 times from 0 to 1000000 and take average.\nPlease wait...");

    startTime = stdlib::GetTicks();
    for( j = 0; j < 10; j++ )
    {
        for( i = 0; i < 1000000; i++ );
    }
    duration = stdlib::GetTicks() - startTime;
    durationF = duration / 10.0;

    stdlib::Print("\n");
    stdlib::Printf("Execution time is %d ms\nAverage time is %g ms\n", {duration, durationF} );

	return durationF;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?