Skip to content

Commit

Permalink
Merge pull request #178 from jsonld-java/perf
Browse files Browse the repository at this point in the history
Add performance tests for toRDF and expand and pretty printing
  • Loading branch information
ansell committed May 18, 2016
2 parents 782e251 + 462d4aa commit ef6e69b
Show file tree
Hide file tree
Showing 7 changed files with 796 additions and 108 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,6 +1,5 @@
language: java
jdk:
- oraclejdk7
- oraclejdk8
notifications:
email:
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -207,6 +207,7 @@ For Developers

`jsonld-java` uses maven to compile. From the base `jsonld-java` module run `mvn clean install` to install the jar into your local maven repository.

The tests require Java-8 to compile, while the rest of the codebase is still compatible and built using the Java-6 APIs.

### Running tests

Expand Down
225 changes: 134 additions & 91 deletions core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java
Expand Up @@ -118,6 +118,23 @@ static void mergeValue(Map<String, Object> obj, String key, Object value) {
}
}

static void laxMergeValue(Map<String, Object> obj, String key, Object value) {
if (obj == null) {
return;
}
List<Object> values = (List<Object>) obj.get(key);
if (values == null) {
values = new ArrayList<Object>();
obj.put(key, values);
}
//if ("@list".equals(key)
// || (value instanceof Map && ((Map<String, Object>) value).containsKey("@list"))
//|| !deepContains(values, value)
// ) {
values.add(value);
//}
}

static void mergeCompactedValue(Map<String, Object> obj, String key, Object value) {
if (obj == null) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/com/github/jsonldjava/utils/Obj.java
Expand Up @@ -11,7 +11,7 @@ public class Obj {
* @return A new {@link Map} instance.
*/
public static Map<String, Object> newMap() {
return new LinkedHashMap<String, Object>(2, 0.75f);
return new LinkedHashMap<String, Object>(4, 0.75f);
}

/**
Expand Down

0 comments on commit ef6e69b

Please sign in to comment.