Skip to content

Commit

Permalink
write out number of tags before writing the tags. #4
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Apr 19, 2015
1 parent a5f6dbe commit 327b5c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/com/conveyal/osmlib/OSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ public OSM (String diskPath) {
}

// Compression has no appreciable effect on speed but reduces file size by about 16 percent.

// Hash table cache (eviction by collision) is on by default with a size of 32k records.
// http://www.mapdb.org/doc/caches.html
// Our objects do not have semantic hash and equals functions, but I suppose it's the table keys that are hashed
// not the values.
db = dbMaker.asyncWriteEnable()
.transactionDisable()
//.cacheDisable()
.compressionEnable()
.cacheSize(50 * 1024 * 1024)
.mmapFileEnableIfSupported()
.closeOnJvmShutdown()
.make();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/conveyal/osmlib/serializer/VarInt.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public static void writeTags(DataOutput out, OSMEntity tagged) throws IOExceptio
writeRawVarint32(out, 0);
return;
}
writeRawVarint32(out, tagged.tags.size());
for (OSMEntity.Tag tag : tagged.tags) {
writeString(out, tag.key);
writeString(out, tag.value);
Expand Down

0 comments on commit 327b5c2

Please sign in to comment.