segunda-feira, 7 de julho de 2008
domingo, 6 de julho de 2008
JRimum Projeto de compontentes Java - Brasileiro
JRimum é um projeto fruto da iniciativa conjunta entre o Grupo JRimum e a Nordeste Fomento Mercantil
objetivando a criação de componentes reutilizáveis Java com foco no domínio de negócios do Brasil.
Bopepo é o primeiro componente disponibilizado pelo projeto - é um componente para gerar boleto bancário com todos os recursos que atendem a Febraban.
Visite: JRimum
objetivando a criação de componentes reutilizáveis Java com foco no domínio de negócios do Brasil.
Bopepo é o primeiro componente disponibilizado pelo projeto - é um componente para gerar boleto bancário com todos os recursos que atendem a Febraban.
Visite: JRimum
segunda-feira, 23 de junho de 2008
Performance: clone() vs. new GregorianCalendar()
Comparação entre quadro formas de utilização de GregorianCalendar.
retirado de link
::Environment::
- JDK "1.6.0" (build 1.6.0-b105)
- Linux (CentOS 4.4)
::Result::
::Code::
By Clone
By Setting MilliSeconds
By Setting Each Field
By Constructor
retirado de link
::Environment::
- JDK "1.6.0" (build 1.6.0-b105)
- Linux (CentOS 4.4)
::Result::
loop | by Clone | by MilliSec | by Setter | by Constructor |
100 | 11ms | 11ms | 5ms | 2ms |
1000 | 59ms | 61ms | 9ms | 6ms |
10000 | 85ms | 71ms | 59ms | 19ms |
30000 | 178ms | 136ms | 102ms | 28ms |
60000 | 279ms | 249ms | 189ms | 42ms |
::Code::
By Clone
public long byClone(final int loop) {
final long start = System.currentTimeMillis();
for (int i = 0; i < loop; i++) {
Calendar cal = (Calendar) Calendar.getInstance().clone();
}
final long end = System.currentTimeMillis();
return end - start;
}
By Setting MilliSeconds
public long byMilliSeconds(final int loop) {
final Calendar now = Calendar.getInstance();
final TimeZone tz = now.getTimeZone();
final long mill = now.getTimeInMillis();
final long start = System.currentTimeMillis();
for (int i = 0; i < loop; i++) {
Calendar cal = new GregorianCalendar(tz);
cal.setTimeInMillis(mill);
}
final long end = System.currentTimeMillis();
return end - start;
}
By Setting Each Field
public long bySetter(final int loop) {
final Calendar now = Calendar.getInstance();
final int currentYear = now.get(Calendar.YEAR);
final int currentMonth = now.get(Calendar.MONTH);
final int currentDate = now.get(Calendar.DATE);
final int currentHour = now.get(Calendar.HOUR);
final int currentMinute = now.get(Calendar.MINUTE);
final int currentSecond = now.get(Calendar.SECOND);
final int currentMilliSecond = now.get(Calendar.MILLISECOND);
final TimeZone tz = now.getTimeZone();
final long start = System.currentTimeMillis();
for (int i = 0; i < loop; i++) {
Calendar cal = new GregorianCalendar(tz);
cal.set(currentYear, currentMonth, currentDate, currentHour, currentMinute, currentSecond);
cal.set(Calendar.MILLISECOND, currentMilliSecond);
}
final long end = System.currentTimeMillis();
return end - start;
}
By Constructor
public long byConstructor(final int loop) {
final Calendar now = Calendar.getInstance();
final int currentYear = now.get(Calendar.YEAR);
final int currentMonth = now.get(Calendar.MONTH);
final int currentDate = now.get(Calendar.DATE);
final int currentHour = now.get(Calendar.HOUR);
final int currentMinute = now.get(Calendar.MINUTE);
final int currentSecond = now.get(Calendar.SECOND);
final int currentMilliSecond = now.get(Calendar.MILLISECOND);
final TimeZone tz = now.getTimeZone();
final long start = System.currentTimeMillis();
for (int i = 0; i < loop; i++) {
Calendar cal = new GregorianCalendar(currentYear, currentMonth, currentDate, currentHour, currentMinute, currentSecond);
cal.set(Calendar.MILLISECOND, currentMilliSecond);
cal.setTimeZone(tz);
}
final long end = System.currentTimeMillis();
return end - start;
}
Assinar:
Postagens (Atom)