Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed JsonPointer cache from evaluation context #23

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c714cde
Compiling path during construction of JsonPointerValue and JsonPathVa…
r0goyal Oct 27, 2022
bd3146d
Skipping checkout in Github auto commit action
r0goyal Oct 27, 2022
ff56631
Merge branch 'master' of github.com:santanusinha/hope into path_compi…
r0goyal Oct 27, 2022
8968128
Not skipping checkout
r0goyal Oct 27, 2022
a4c2249
Reduced benchmark time to test out action faster
r0goyal Oct 27, 2022
70c44dc
Comitting benchmark results created by Github Actions
r0goyal Oct 27, 2022
c2de8d2
Reverted benchmark times
r0goyal Oct 27, 2022
78cebf2
Comitting benchmark results created by Github Actions
r0goyal Oct 27, 2022
2cc160e
Removed JsonPointer cache
r0goyal Oct 27, 2022
1d46335
Comitting benchmark results created by Github Actions
r0goyal Oct 27, 2022
f0ac6e8
Merge branch 'master' into pointer_cache_removal
r0goyal Oct 27, 2022
9fa22be
Merge branch 'pointer_cache_removal' of github.com:santanusinha/hope …
r0goyal Oct 27, 2022
8284fef
Reverted formatting changes in Converters.java
r0goyal Oct 27, 2022
6d770f2
Comitting benchmark results created by Github Actions
r0goyal Oct 27, 2022
d610c47
Merge branch 'master' of github.com:santanusinha/hope into pointer_ca…
r0goyal Nov 2, 2022
93916f5
Merge branch 'pointer_cache_removal' of github.com:santanusinha/hope …
r0goyal Nov 2, 2022
3edc556
Comitting benchmark results created by Github Actions
r0goyal Nov 2, 2022
ef574d8
Merge branch 'master' into pointer_cache_removal
r0goyal Nov 4, 2022
0dcc8e4
Merge branch 'pointer_cache_removal' of github.com:santanusinha/hope …
r0goyal Nov 4, 2022
2c7239d
Comitting files changed by Github Actions
r0goyal Nov 4, 2022
a079ae6
Merge branch 'master' into pointer_cache_removal
r0goyal Nov 4, 2022
539d0c7
Comitting files changed by Github Actions
r0goyal Nov 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions hope-core/src/main/java/io/appform/hope/core/utils/Converters.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,10 @@ private static JsonNode nodeForJsonPath(
private static JsonNode nodeForJsonPointer(
JsonPointerValue jsonPointerValue,
Evaluator.EvaluationContext evaluationContext) {
final String pointer = jsonPointerValue.getPointer();
final Map<String, JsonNode> jsonPointerEvalCache = evaluationContext.getJsonPointerEvalCache();
return jsonPointerEvalCache
.computeIfAbsent(pointer, key -> {
final JsonNode value = evaluationContext.getRootNode().at(jsonPointerValue.getJsonPointer());
return null == value
? NullNode.getInstance()
: value;
});
final JsonNode value = evaluationContext.getRootNode().at(jsonPointerValue.getJsonPointer());
return null == value
? NullNode.getInstance()
: value;
}

private static <T> T extractNodeValue(
Expand Down Expand Up @@ -707,4 +702,4 @@ private static List<Object> arrayToObjectList(
.collect(Collectors.toList());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public static class EvaluationContext {
private final JsonNode rootNode;
private final Evaluator evaluator;
private final Map<String, JsonNode> jsonPathEvalCache = new HashMap<>(128);
private final Map<String, JsonNode> jsonPointerEvalCache = new HashMap<>(128);
}

public static class LogicEvaluator extends VisitorAdapter<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 2,
"threads" : 1,
"forks" : 3,
"mean_ops" : 62901.01173837364
"mean_ops" : 57357.653438961665
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 2,
"threads" : 1,
"forks" : 3,
"mean_ops" : 6281.915064030178
"mean_ops" : 6701.260259282096
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 2,
"threads" : 1,
"forks" : 3,
"mean_ops" : 77736.89868315442
"mean_ops" : 63563.64388672777
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 2,
"threads" : 1,
"forks" : 3,
"mean_ops" : 22744.739647177757
"mean_ops" : 33326.55546688091
}