What problem are you trying to solve?
Lib/src/main/java/me/egg82/arr/common/AbstractFetchableAPIObject.java:24
return new JsonNode(node.toString());
A full serialise to String plus a full re-parse into a second tree, to hand back a defensive copy.
On a 65 MB tree that measured 335-547 ms and another full-size tree per call. It lands on the cache-write path, so roughly hourly per instance rather than every cycle - Movie.cacheTime() is 65 minutes against a 1 hour default interval.
Both real callers are writeCache, at AbstractArrAPI.java:276 and :314, and both do the same thing: serialise it straight back out to the cache file and drop it. Neither needs isolation from the original.
What would you like Fetcharr to do?
Handing the tree to something that immediately serialises it shouldn't cost a full copy of it first.
Return the reference. If some caller genuinely needs isolation, give that caller an explicit copy() rather than charging every caller for one.
This overlaps with the retained-tree issue - if writeCache takes the tree directly instead of calling node(), both problems go away together.
Optional additional context or use case that could be helpful
node() is on the public FetchableAPIObject interface, so changing what it returns is a contract change even though nothing in-tree depends on the copy.
What problem are you trying to solve?
Lib/src/main/java/me/egg82/arr/common/AbstractFetchableAPIObject.java:24A full serialise to String plus a full re-parse into a second tree, to hand back a defensive copy.
On a 65 MB tree that measured 335-547 ms and another full-size tree per call. It lands on the cache-write path, so roughly hourly per instance rather than every cycle -
Movie.cacheTime()is 65 minutes against a 1 hour default interval.Both real callers are
writeCache, atAbstractArrAPI.java:276and:314, and both do the same thing: serialise it straight back out to the cache file and drop it. Neither needs isolation from the original.What would you like Fetcharr to do?
Handing the tree to something that immediately serialises it shouldn't cost a full copy of it first.
Return the reference. If some caller genuinely needs isolation, give that caller an explicit
copy()rather than charging every caller for one.This overlaps with the retained-tree issue - if
writeCachetakes the tree directly instead of callingnode(), both problems go away together.Optional additional context or use case that could be helpful
node()is on the publicFetchableAPIObjectinterface, so changing what it returns is a contract change even though nothing in-tree depends on the copy.