Skip to content

Draft: intel: Combine perf query counter strings

Matt Turner requested to merge mattst88/mesa:intel-perf-size-string into main

The compiler does a good job of deduplicating strings already, but we can eliminate the pointers to each string by combining the strings into a single char array and storing only an index into that array.

The longest of the char arrays is the descriptions array, which is a little over 45 KiB, so still under MSVC's 64 KiB string literal limit [0]. Because the string length is under 64 KiB we can use uint16_t as the index type, which roughly doubles our savings (from 155 KiB to 320 KiB).

In total, this saves around 320 KiB of .text, or 21% of intel_perf_metrics.c.o, 2.2% of iris_dri.so, 3.7% of libvulkan_intel.so.

----
   text	   data	    bss	    dec	    hex	filename
1537275	      0	      0	1537275	 1774fb	meson-generated_.._intel_perf_metrics.c.o (before)
1211449	      0	      0	1211449	 127c39	meson-generated_.._intel_perf_metrics.c.o (after)
----
   text	   data	    bss	    dec	    hex	filename
14969603 365584	 209984	15545171 ed3353	iris_dri.so (before)
14642315 365584	 209984	15217883 e834db	iris_dri.so (after)

----
   text	   data	    bss	    dec	    hex	filename
8844313	 214192	  22784	9081289	 8a91c9	libvulkan_intel.so (before)
8517065	 214192	  22784	8754041	 859379	libvulkan_intel.so (after)
----

[0] https://docs.microsoft.com/en-us/cpp/cpp/string-and-character-literals-cpp?view=msvc-170&viewFallbackFrom=vs-2019

Merge request reports