Page MenuHomeFeedback Tracker

Please add alternative syntax to BIS_fnc_codePerformance
Reviewed, WishlistPublic

Description

Current syntax (default 10000 iterations)

["...your code where you need to escape ""..."] call BIS_fnc_codePerformance;

Proposed alternative syntax

{...yourcode where you don't need to escape anything because it is a code not string..} call BIS_fnc_codePerformance;

This is my third attempt through different channels to get this added. Why? Because it is easy to memorize and because it makes sense :)

Details

Legacy ID
1977154809
Severity
None
Resolution
Open
Reproducibility
Always
Category
Feature Request

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Feature Request.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Open.
Killzone_Kid set Legacy ID to 1977154809.May 7 2016, 3:59 PM

It's not as simple when you look at the source for the function. You'd need an extra call that would skew the testing.

It is simple, very simple...Observe:

ORIGINAL:

_codeText = compile format [
"

		_time = diag_ticktime;
		for '_i' from 1 to %2 do {
			%1
		};
		_timeResult = ((diag_ticktime - _time) / _cycles) * 1000;

",
_code,
_cycles
];

MODIFIED:

_codeText = compile format [
"

		_time = diag_ticktime;
		for '_i' from 1 to %2 do %1;
		_timeResult = ((diag_ticktime - _time) / _cycles) * 1000;

",
if (typeName _code == typeName "") then [{"{" + _code + "}"},{_code}],
_cycles
];

Ah, good point, setting as reviewed.

Also I suggest subtract the time it takes to run empty code from the total time, this way the for loop testing mechanism will be counted out.

[""] call bis_fnc_codePerformance should be 0 theoretically but it is something like 0.0028ms