ClojureScript

Don't flush for every emitted line

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code

Description

When profiling compilation, java.io.BufferedWriter.flush() shows up near the top of the profile, with the root cause being the println here:

https://github.com/clojure/clojurescript/blob/d4db18970c8eec587b2c9e022034983e29eb8e81/src/main/clojure/cljs/compiler.cljc#L206

It is probably not important to flush every line of emitted JavaScript while compiling, and binding flush-on-newline to false here eliminates this from the top of the profile.

Activity

Hide
Mike Fikes added a comment -

I tested this and appear to get a 2.9% improvement.

The test involves the JVM ClojureScript portion of the Planck compile, on a non-SDD drive, measuring using :compiler-stats.

Raw measurements of 10 runs (first two discarded to ensure no transients):

Master: 33305.826946, 32951.074239, 33232.689479 ,33437.3924, 33084.874104, 33330.858312, 32704.202852, 32971.140835, 32784.698435, 33677.632887
Patched: 32162.290706, 32381.684736, 31956.178709, 31802.413141, 32607.124829, 32149.32672, 32281.441289, 32423.652908, 31935.573276, 32233.427539

Show
Mike Fikes added a comment - I tested this and appear to get a 2.9% improvement. The test involves the JVM ClojureScript portion of the Planck compile, on a non-SDD drive, measuring using :compiler-stats. Raw measurements of 10 runs (first two discarded to ensure no transients): Master: 33305.826946, 32951.074239, 33232.689479 ,33437.3924, 33084.874104, 33330.858312, 32704.202852, 32971.140835, 32784.698435, 33677.632887 Patched: 32162.290706, 32381.684736, 31956.178709, 31802.413141, 32607.124829, 32149.32672, 32281.441289, 32423.652908, 31935.573276, 32233.427539

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: