ClojureScript

Optimize source map gen-col counting

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Approval:
    Accepted

Description

When source maps are generated, this line https://github.com/clojure/clojurescript/blob/4f3707624846a2cf0345859e41370ec172da73c4/src/main/clojure/cljs/compiler.cljc#L209-L211
which updates :gen-col, is evidently called frequently enough where it can account for 10 to 20% of the perf when compiling large codebases like Coal Mine.

  1. CLJS-2894.patch
    06/Sep/18 12:57 PM
    5 kB
    Mike Fikes
  2. CLJS-2894-2.patch
    06/Sep/18 1:28 PM
    5 kB
    Mike Fikes

Activity

Hide
Mike Fikes added a comment -

CLJS-2894.patch moves :gen-col out to a separate dynamic var which holds an AtomicLong. This should have sufficient threading properties when :parallel-build true, as this dynamic var is effectively a thread-local.

For self-hosted, it roughly keeps the previous approach, with some mild optimizations (especially avoiding count on string).

Show
Mike Fikes added a comment - CLJS-2894.patch moves :gen-col out to a separate dynamic var which holds an AtomicLong. This should have sufficient threading properties when :parallel-build true, as this dynamic var is effectively a thread-local. For self-hosted, it roughly keeps the previous approach, with some mild optimizations (especially avoiding count on string).
Hide
Mike Fikes added a comment -

CLJS-2894-2.patch fixes a self-host bug in the first patch and tweaks a little whitespace formatting.

Show
Mike Fikes added a comment - CLJS-2894-2.patch fixes a self-host bug in the first patch and tweaks a little whitespace formatting.
Hide
Mike Fikes added a comment -
Show
Mike Fikes added a comment - See https://github.com/binaryage/dirac/issues/81

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: