Hi
Two things
(1) stack-sampling profilers like this become less reliable when there are no
more major things sticking out, because
they can only sample at GC-safepoints, which tends to miss a lot of internal
work going on in the VM.
The better commercial profilers will give decent results in these situations.
(2) I notice that the BCD date values in ValueTimestamp and DateTimeUtils don't
need to be a long.
It's stored like this:
return ((long) year << SHIFT_YEAR) | (month << SHIFT_MONTH) | day;
which expands to
return ((long) year << 9) | (month << 5) | day;
If we store it in an int, we have 22 bits of range for the year, which I
suspect is plenty :-)
Regards, Noel Grandin.
Thomas Mueller wrote:
> Hi,
>
> I don't know why it is slower now. According to my test, the main
> problem is PreparedStatement.setString. I don't see much that could be
> improved. Here my profiling results (most common stack traces;
> generated using the built-in Profiler tool):
>
> Profiler: top 5 stack trace(s) of 9956 ms [build-161]:
> 639/2196 (29%):
> at org.h2.jdbc.JdbcPreparedStatement.setString(JdbcPreparedStatement.java:326)
> at db.TestSimpleDb.test(TestSimpleDb.java:74)
> at db.TestSimpleDb.main(TestSimpleDb.java:22)
> 239/2196 (10%):
> at db.TestSimpleDb.test(TestSimpleDb.java:75)
> at db.TestSimpleDb.main(TestSimpleDb.java:22)
> 104/2196 (4%):
> at java.lang.Integer.getChars(Integer.java:349)
> at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:598)
> at java.lang.StringBuilder.append(StringBuilder.java:212)
> at db.TestSimpleDb.test(TestSimpleDb.java:75)
> at db.TestSimpleDb.main(TestSimpleDb.java:22)
> 102/2196 (4%):
> at org.h2.value.Value.convertTo(Value.java:504)
> at org.h2.table.Column.convert(Column.java:155)
> at org.h2.command.dml.Insert.insertRows(Insert.java:112)
> at org.h2.command.dml.Insert.update(Insert.java:84)
> at org.h2.command.CommandContainer.update(CommandContainer.java:73)
> at org.h2.command.Command.executeUpdate(Command.java:226)
> at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:181)
> at db.TestSimpleDb.test(TestSimpleDb.java:78)
> at db.TestSimpleDb.main(TestSimpleDb.java:22)
> 84/2196 (3%):
> at org.h2.util.DateTimeUtils.dateValueFromDate(DateTimeUtils.java:735)
> at org.h2.value.ValueTimestamp.get(ValueTimestamp.java:70)
> at
> org.h2.jdbc.JdbcPreparedStatement.setTimestamp(JdbcPreparedStatement.java:402)
> at db.TestSimpleDb.test(TestSimpleDb.java:71)
> at db.TestSimpleDb.main(TestSimpleDb.java:22)
> packages:
> 36%: org.h2.jdbc
> 20%: db
> 14%: org.h2.value
> 11%: org.h2.util
> 8%: org.h2.table
>
> Regards,
> Thomas
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.