shaa108 / h2database

Automatically exported from code.google.com/p/h2database
1 stars 0 forks source link

ValueGeometry enhancement #535

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently (v 1.3.174) ValueGeometry convert to/from WKB (binary) when it is not 
necessary, it convert also in WKT while this is useless.

On my computer, a simple table copy that contain a geometry type take now 2 
seconds instead of 8 seconds.

You can find the commits in this branch:

https://github.com/nicolas-f/H2-Mirror/tree/optimize-geometry

Original issue reported on code.google.com by nico.de...@gmail.com on 4 Dec 2013 at 8:08

GoogleCodeExporter commented 8 years ago
OK I will try to apply the patch.

As for ValueGeometry, wouldn't it be even better to keep both the byte array 
and the geometry?

Original comment by thomas.t...@gmail.com on 14 Dec 2013 at 9:10

GoogleCodeExporter commented 8 years ago
> As for ValueGeometry, wouldn't it be even better to keep both the byte array 
and the geometry?

Sorry I saw you did that in the second patch.

However, this doesn't make sense:
    public int hashCode() {
        return toWKB().hashCode();
    }

byte[].hashCode() is the hash code of the reference, not of the content. I will 
use Arrays.hashCode(toWKB()) instead. Wouldn't it make sense to cache the hash 
code (like it's done in java.lang.String)?

Original comment by thomas.t...@gmail.com on 14 Dec 2013 at 9:16

GoogleCodeExporter commented 8 years ago
> Hash code

Sorry, I saw you fixed that in the third patch. We could still cache the hash 
code. I will try that.

Original comment by thomas.t...@gmail.com on 14 Dec 2013 at 9:20

GoogleCodeExporter commented 8 years ago
The patches are now applied in revision 5334 (including remembering the hash 
code, formatting changes, and changelog entry).

Original comment by thomas.t...@gmail.com on 14 Dec 2013 at 9:22