Smattr / clink

a modern re-implementation of Cscope
The Unlicense
41 stars 2 forks source link

join: open code 'asprintf' call #172

Closed Smattr closed 1 year ago

Smattr commented 1 year ago

Surprisingly asprintf shows up in profiling as 4.78% of the cost of a no-op re-build and 0-result returning search. Reading the GCC docs, the compiler does not know this function as a built-in. Moving to an sprintf/snprintf version has no effect; apparently GCC’s knowledge of these functions as built-ins does not help either. However going all the way to breaking the string construction into its basic elements does have an impact. This drops asprintf below 1% in this particular scenario. Overall execution time is sped up by ~3.86%.