Sha256: cddf79fdf98805126861e6a3c28fe4c13f2a4c1a4f1649722b77d29e92147b67

Contents?: true

Size: 868 Bytes

Versions: 12

Compression:

Stored size: 868 Bytes

Contents

<script type="text/javascript">
(function(){
	// Conclusions:
	// slice() is a little faster than concat() except on Chrome
	// This clone() is slower on FF & IE but takes 50% on Safari & Chrome

	var SIZE = 1e4,
		LOOPS = 500;
	
	var arr = new Array(SIZE);
	for ( var i=arr.length-1; i >= 0; --i )
		arr[i] = 0;

	var t = new Date;
	for ( i=0; i < LOOPS; i++ )
		arr.slice(0);
	var tslice = new Date - t;
	
	t = new Date;
	for ( i=0; i < LOOPS; i++ )
		arr.concat();
	var tconcat = new Date - t;
	
	// clone() is just to see how fast built-ins are
	t = new Date;
	for ( i=0; i < LOOPS; i++ )
		clone(arr);
	var tclone = new Date - t;
	
	alert([
		'slice:'+tslice,
		'concat:'+tconcat,
		'clone:'+tclone
	].join('\n'));
	
	
	function clone(arr){
		var i = arr.length,
			copy = new Array(i);
			
		while (i--)
			copy[i] = arr[i];
			
		return copy;
	}
})();
</script>

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
lady_josephine-0.7.0 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.6.3 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.6.2 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.6.1 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.6.0 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.5.0 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.0.4 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.0.3 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.0.2 vendor/assets/components/jquery/speed/slice.vs.concat.html
lady_josephine-0.0.1 vendor/assets/components/jquery/speed/slice.vs.concat.html
guff-compass-1.0.0 demo/bower_components/jquery/speed/slice.vs.concat.html
guff-compass-0.7.0 demo/bower_components/jquery/speed/slice.vs.concat.html