view src/treecms/proto/test/StringConcatTest.java @ 35:9d248304be96

added StringConcatTest
author shoshi
date Tue, 07 Dec 2010 18:42:51 +0900
parents
children a72718a0bccf
line wrap: on
line source

package treecms.proto.test;

import java.nio.CharBuffer;

import org.junit.Test;
import org.junit.runner.JUnitCore;


public class StringConcatTest
{
	public static void main(String _args[])
	{
		JUnitCore.main(StringConcatTest.class.getName());
	}
	
	private String m_str = "123456789012345678901234567890";
	
	@Test
	public void testCharBuffer()
	{
		for(int j = 0;j < 1000;j ++){
			CharBuffer buffer = CharBuffer.allocate(1000*30);
			for(int i = 0;i < 1000;i ++){
				buffer.append(m_str);
			}
		}
	}
	
	@Test
	public void testStringBuffer()
	{
		for(int j = 0;j < 1000;j ++){
			StringBuffer tmp = new StringBuffer();
			for(int i = 0;i < 1000;i ++){
				tmp.append(m_str);
			}
		}
	}
	
	@Test
	public void testString()
	{
		for(int j = 0;j < 10;j ++){
			String tmp = "";
			for(int i = 0;i < 1000;i ++){
				tmp += m_str; //Iketenai!!!!
			}
		}
	}
}