This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-25
Channels
- # beginners (26)
- # boot (1)
- # cider (21)
- # cljdoc (26)
- # cljs-dev (7)
- # clojure (99)
- # clojure-gamedev (6)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-russia (1)
- # clojure-spec (5)
- # clojure-uk (59)
- # clojurescript (49)
- # clojutre (6)
- # component (13)
- # core-async (2)
- # cursive (30)
- # data-science (2)
- # datomic (29)
- # emacs (9)
- # fulcro (100)
- # hyperfiddle (1)
- # jobs (2)
- # luminus (4)
- # lumo (23)
- # off-topic (22)
- # other-languages (37)
- # parinfer (1)
- # re-frame (2)
- # reagent (5)
- # reitit (12)
- # ring (12)
- # rum (3)
- # shadow-cljs (168)
- # slack-help (1)
- # spacemacs (7)
- # specter (2)
- # tools-deps (8)
- # vim (11)
- # yada (3)
I've just asked this in #clojurescript: https://clojurians.slack.com/archives/C03S1L9DN/p1532481825000054
i.e., any reason why re-seq does a second search to find out the index of the matched string https://github.com/clojure/clojurescript/blob/r1.10.339-24-g0773689e/src/main/cljs/cljs/core.cljs#L9851
instead of using .exec
on the regex directly and getting both from there? like
cljs.user> (let [m (.exec #"br\w+" "the quick brown fox yadda yadda")]
{:index (.-index m) :text (first m)})
{:index 10, :text "brown"}
I haven't measured what the performance gains would be, if any. I'm just curious if there's a strong reason why it's being done this way. if not, shall I benchmark this change and contribute a patch if the improvement is significant?
@euccastro Hrm. Looks like it has been that way for 7 years. So it may just be a matter of trying to reverse engineer what it is doing at this point.
btw what it's doing seems pretty clear. why it's doing it that particular way is what I don't understand yet