summaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-05-03 23:14:26 +0000
committerDavid Robillard <d@drobilla.net>2008-05-03 23:14:26 +0000
commita2706dd069fde845e8a6f2d46112db7c1727a0db (patch)
tree750c92379e6acc00e13836d0bb0223c600c5878e /src/world.c
parent9dd89e3a4b9d9f0bfb408c827358f8e97c12373b (diff)
downloadlilv-a2706dd069fde845e8a6f2d46112db7c1727a0db.tar.gz
lilv-a2706dd069fde845e8a6f2d46112db7c1727a0db.tar.bz2
lilv-a2706dd069fde845e8a6f2d46112db7c1727a0db.zip
Use new redland "trees" store, if available (100 fold performance increases in some cases).
git-svn-id: http://svn.drobilla.net/lad/slv2@1195 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/world.c b/src/world.c
index bebf540..01201fb 100644
--- a/src/world.c
+++ b/src/world.c
@@ -43,10 +43,15 @@ slv2_world_new()
librdf_world_open(world->world);
- // Testing shows hashes to be faster here
- //world->storage = librdf_new_storage(world->world, "memory", NULL, NULL);
- world->storage = librdf_new_storage(world->world, "hashes", NULL,
- "hash-type='memory'");
+ world->storage = librdf_new_storage(world->world, "trees", NULL, NULL);
+ if (!world->storage) {
+ fprintf(stderr, "Warning: Unable to create \"trees\" RDF storage.\n");
+ fprintf(stderr, "Performance can be improved by upgrading librdf.\n");
+ // Testing shows "hashes" to be faster than "memory" (list) here
+ world->storage = librdf_new_storage(world->world, "hashes", NULL,
+ "hash-type='memory'");
+ }
+
if (!world->storage)
goto fail;
@@ -99,10 +104,15 @@ slv2_world_new_using_rdf_world(librdf_world* rdf_world)
world->local_world = false;
- // Testing shows hashes to be faster here
- //world->storage = librdf_new_storage(world->world, "memory", NULL, NULL);
- world->storage = librdf_new_storage(world->world, "hashes", NULL,
- "hash-type='memory'");
+ world->storage = librdf_new_storage(world->world, "trees", NULL, NULL);
+ if (!world->storage) {
+ fprintf(stderr, "Warning: Unable to create \"trees\" RDF storage.\n");
+ fprintf(stderr, "Performance can be improved by upgrading librdf.\n");
+ // Testing shows "hashes" to be faster than "memory" (list) here
+ world->storage = librdf_new_storage(world->world, "hashes", NULL,
+ "hash-type='memory'");
+ }
+
if (!world->storage)
goto fail;
@@ -211,8 +221,10 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
bundle_uri->val.uri_val, (const unsigned char*)"manifest.ttl");
/* Parse the manifest into a temporary model */
- librdf_storage* manifest_storage = librdf_new_storage(world->world,
- "memory", NULL, NULL);
+ librdf_storage* manifest_storage = librdf_new_storage(world->world, "trees", NULL, NULL);
+ if (manifest_storage == NULL)
+ manifest_storage = librdf_new_storage(world->world, "memory", NULL, NULL);
+
librdf_model* manifest_model = librdf_new_model(world->world,
manifest_storage, NULL);
librdf_parser_parse_into_model(world->parser, manifest_uri, NULL,