Performance benchmarking reveals that C++ lambdas with perfect type information deliver the best closure performance, while GNU Nested Functions perform poorly enough to question their viability. Adding a single level of indirection (like int* instead of int) significantly degrades performance. Static and thread_local variables for passing context are slower than adding explicit function parameters. The analysis suggests C needs both type-preserving closures and thin type erasure (wide function pointers) for optimal performance, as existing extensions like Apple Blocks and GNU Nested Functions have fundamental design issues.

19m read timeFrom thephd.dev
Post cover image
Table of contents
Skipping the IntroductionsExperimental SetupPlain C - New CategoriesResultsInsightsFinal TakewaysP.S.

Sort: