stringer icon indicating copy to clipboard operation
stringer copied to clipboard

Make append! more aggressive

Open bsless opened this issue 3 years ago • 5 comments
trafficstars

There are instances where append! emits unnecessary code which involves more work at run time that can be pushed to compile time.

In particular:

  • stringable arguments can call toString at compile time and elide nil check
  • expressions which aren't symbols, application or nil can elide nil checks

bsless avatar Jan 23 '22 08:01 bsless

I tried running the benchmarks but results were a bit ambiguous, any way you think I can get higher fidelity results?

bsless avatar Jan 23 '22 08:01 bsless

@bsless Thanks for the PR! One thing I generally tweak is the concurrency level, which can make the benchmark not be biased by the CPU cache coherence in absence of CPU scheduling across threads. Real life scenarios are generally highly concurrent with varying workload.

Example tweak:

CITIUS_CONCURRENCY=128 lein with-profile c10,perf do clean, test

kumarshantanu avatar Jan 23 '22 09:01 kumarshantanu

Looking at the tests I'm not sure they can even give meaningful results if the symbols are bound in let forms anyway, I'll need to engineer another scenario. How do you feel about JMH?

bsless avatar Jan 23 '22 19:01 bsless

JMH sounds like a good idea to me.

kumarshantanu avatar Jan 24 '22 12:01 kumarshantanu

Starting a preliminary patch to add JMH

bsless avatar Jan 24 '22 17:01 bsless