Some sexy semi weakass macro style stuff going on here with the profiling
This was tremendously elaborate to work through the logic. I really am not sure if clojure can be efficient enough to be worth it, though, because of how short the resultant JS is here. It's just I'd have no idea how to go one more meta-level above this.