We're updating the issue view to help you get more done. 

Make rose trees a deftype

Description

This turns rose trees into a custom `deftype` that implements `clojure.lang.Indexed` (for backwards compatability - it means you can still use nth on them without any changes, and means we can interchange vectors with them).

It's just a performance patch - I noticed when profiling the test.check suite I have at Yeller that a lot of time was spent creating clojure vectors (it was the highest sample in the suite).

This produced a noticeable difference (at 95% confidence rating as measured across test runs using ministat) on my test suite, but didn't make such a difference on `test.check`'s (no noticeable difference at 95% confidence). I assume that's because of generator complexity.

I've also minorly changed `root` and `children` in rose-tree.clj - they no longer call `nth` twice, just once. This produced again, a minorly noticeable perf difference. I tried as well overriding them to an interface and having `RoseTree` implement it, but apparently the JIT's inlining is smart enough (even in C1) that there's no noticeable difference between that and children/root being implemented with nth.

Environment

None

Status

Assignee

gfredericks

Reporter

Tom Crayford

Labels

Approval

None

Patch

Code

Priority

Minor