MyDeveloperDay added a comment.

We don't really have any performance tests, but the following shows some 
analysis, all builds are release build:

- clang-format-ns is built with this change (compiled with VS2017)
- clang-format is without (compiled with VS2017)
- c:/Program\ Files/LLVM/bin/clang-format is the last Feb 2020 snapshot build 
version of clang-format  (probably compiled with clang-cl)
- build_release_cl/clang-format with this change  (compiled with clang-cl from 
Fab2020 snapshot) _ build_2019/clang-format with this change (compiled with 
VS2019)

The test is to run clang-format over the largest file in LLVM

./libcxxabi/test/test_demangle.pass.cpp is 5.2M in size = 30,000 lines, 29799 
opening and closing braces

For a file this size I think I'd expect IO to dominate (I'm running this test 
on an Intel i7-800 CPU @3,.20GHz with an SSD, Running cygwin in Windows 10)

I've run these tests multiple times and they are often the same or similar 
timings (I'm running the base clang-format as a benchmark twice because the 
first run is often slower

  time /clang/build_release/bin/clang-format 
../libcxxabi/test/test_demangle.pass.cpp > speed1 (Baseline to get 
test_demangle.pass.cpp into system cache)
  
  real    0m3.957s
  user    0m0.000s
  sys     0m0.000s
  
  time /clang/build_release/bin/clang-format-ns 
../libcxxabi/test/test_demangle.pass.cpp > speed1
  
  real    0m3.994s
  user    0m0.000s
  sys     0m0.000s
  time /clang/build_release/bin/clang-format 
../libcxxabi/test/test_demangle.pass.cpp > speed1
  
  real    0m3.990s
  user    0m0.000s
  sys     0m0.000s
  
  time  c:/Program\ Files/LLVM/bin/clang-format 
../libcxxabi/test/test_demangle.pass.cpp > speed1
  
  real    0m3.793s
  user    0m0.000s
  sys     0m0.000s
  
  time /clang/build_release_cl/bin/clang-format 
../libcxxabi/test/test_demangle.pass.cpp > speed1
  
  real    0m3.442s
  user    0m0.000s
  sys     0m0.000s
  
  time /clang/build_2019/bin/clang-format 
../libcxxabi/test/test_demangle.pass.cpp > speed1
  
  real    0m3.820s
  user    0m0.000s
  sys     0m0.000s

The speed difference of this change of clang-format is fairly negligible, 
varying by about +/-20ms one way or the other (often swinging the other between 
runs or depending on which goes first)

I feel this change is relatively low impact, (perhaps the loop could be moved 
into some earlier equivalent loop but for clarity, I think it's ok here for 
now.)

I'm not 100% sure how we could reliably test performance generally in 
clang-format, but I think it would be good to have something.

The key takeaway is likely that clang-cl is quicker! and it obviously more 
about which compiler you choose.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80830/new/

https://reviews.llvm.org/D80830



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to