Skip to content

Could default exported function perform a tiny bit better? #28

Description

@realamirhe
export default function () {
- 	var i=0, tmp, x, str='';
+ 	var tmp, x, len=arguments.length, str='', i=0;
-	while (i < arguments.length) {
+	while (i < len) {
		if (tmp = arguments[i++]) {
			if (x = toVal(tmp)) {
				str && (str += ' ');
				str += x
			}
		}
	}
	return str;
}

Benchmark on only string concatenation shows an increase of about 1,000,000 operation/sec.
Note: I got benchmark results only in node, in a really inaccurate way. but theoretically, it must increase the performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions