Hidden Overhead of a Function APIdesigned ones!When talking about performance, we typically think about the function logic. We’ll see that a well designed function API can have an even larger impact.How will we compare performance? ● they might be, and often are, totally irrelevant to speed. 17 Credit to Khalil Estell: Firefox function distribution 157946 functions above (127B) 167404 functions below (127B)Understanding how machine problems? Pros: ● Default constructor before the function call is avoided 36Does it solve our problems? Pros: ● Default constructor before the function call is avoided Cons (unless we fully trust the0 码力 | 158 页 | 2.46 MB | 6 月前3
Back to Basics - Function Call ResolutionBack to Basics - Function Call Resolution Copyright © 2024 by Ben Saks and Dan Saks Back to Basics: Function Call Resolution by Ben Saks and Dan Saks September, 2024 1 Saks & Associates These notes +1-412-521-4117 (voice) service@saksandassociates.com saksandassociates.com 2Back to Basics - Function Call Resolution Copyright © 2024 by Ben Saks and Dan Saks About Ben Saks Ben Saks is the chief Ben earned a B.A. with Distinction in Computer Science from Carleton College. 4Back to Basics - Function Call Resolution Copyright © 2024 by Ben Saks and Dan Saks About Dan Saks Dan Saks is the president0 码力 | 44 页 | 1.30 MB | 6 月前3
Limitations and Problems in std::function and SimilarLimitations and Problems in std::function and similar constructs Amandeep Chawla | Sr. Computer Scientist II amandeep@adobe.com | adchawla@gmail.com Image by Bruno Tornielli© 2024 Adobe. All Rights we can control. ▪ std::function© 2024 Adobe. All Rights Reserved. Adobe Confidential. Task Based Mechanism© 2024 Adobe. All Rights Reserved. Adobe Confidential. std::function ▪ Is a class template ▪ It is a general-purpose polymorphic function wrapper ▪ Instances of std::function can store, copy, and invoke any CopyConstructible Callable target ▪ Uses type-erasure under the hood to gain all the0 码力 | 62 页 | 3.57 MB | 6 月前3
Dynamically Loaded Libraries Outside the StandardLoadModule directive • C extension for CPython (.pyd on Windows) – import module_name • Java Native Interface (JNI) – System.loadLibrary(name) Customized file formats for dynamic loading9 CppCon 2021 | #include LoadLibrary("mlib.dll") – ditto, but searches default DLL directories • GetProcAddress(handle, "function_or_variable_name") – get addresses to entities • FreeLibrary(handle) – unload the library • GetLastError() address of the actual function Surprise of delay loading31 CppCon 2021 | • The addresses of functions may change at runtime – address of thunk ≠ address of the actual function Surprise of delay loading320 码力 | 100 页 | 3.98 MB | 6 月前3
Making Libraries Consumable for Non-C++ Developersinteroperability? Don’t touch it! Glue code? Boiler plate? A nightmare? Application binary interface (ABI) Calling conventions Marshalling Was I supposed to free that? Was I not supposed to free post-1972 Common Object Model (COM) – 1993 Foreign function interface (libffi) – 1996 Simplified Wrapper and Interface Generator (SWIG) – 1996 JVM – Java Native Interface (JNI) – 1997 .NET – Platform Invoke (P/Invoke) dev- >get_data_from(); return d.a + d.b; The get_data_from() function returns the struct in registers, but the get_data_from() member function returns in caller provided memory. This is often unexpected0 码力 | 29 页 | 1.21 MB | 6 月前3
Delivering safe C++book: • A “new function” creates the run-time environment for member functions • A “delete function” reverses that • Later (1983) • “new function” -> constructor • “delete function” -> destructor • -CppCon - October 2023 50Invalidation assumptions • No const member function invalidates (easily validated) • Any non-const member function invalidates • Add [[not_invalidating]] to non-const member functions of many casts) • We mustn’t require users to mark every call to a different profile • A single “foreign call” annotation is too coarse • We need to know which profile or aspect of a profile that’s violated0 码力 | 74 页 | 2.72 MB | 6 月前3
Conan 2.0 Documentationbroken. • Only documented features in https://docs.conan.io are considered part of the public interface of Conan. Private implementation details, and everything not included in the documentation is subject extension points, named “plugins” have been added, to provide advanced and typically orthogonal function- ality to what the Conan recipes implement. These plugins can be shared, managed and installed via this case, as our project uses CMake as the build system, we call to cmake_layout(). Calling this function will set the expected locations for a CMake project. • The generate() method prepares the build0 码力 | 652 页 | 4.00 MB | 1 年前3
Conan 2.1 Documentationbroken. • Only documented features in https://docs.conan.io are considered part of the public interface of Conan. Private implementation details, and everything not included in the documentation is subject extension points, named “plugins” have been added, to provide advanced and typically orthogonal function- ality to what the Conan recipes implement. These plugins can be shared, managed and installed via this case, as our project uses CMake as the build system, we call to cmake_layout(). Calling this function will set the expected locations for a CMake project. • The generate() method prepares the build0 码力 | 694 页 | 4.13 MB | 1 年前3
Conan 2.5 Documentationbroken. • Only documented features in https://docs.conan.io are considered part of the public interface of Conan. Private implementation details, and everything not included in the documentation is subject extension points, named “plugins” have been added, to provide advanced and typically orthogonal function- ality to what the Conan recipes implement. These plugins can be shared, managed and installed via this case, as our project uses CMake as the build system, we call to cmake_layout(). Calling this function will set the expected locations for a CMake project. • The generate() method prepares the build0 码力 | 769 页 | 4.70 MB | 1 年前3
Conan 2.4 Documentationbroken. • Only documented features in https://docs.conan.io are considered part of the public interface of Conan. Private implementation details, and everything not included in the documentation is subject extension points, named “plugins” have been added, to provide advanced and typically orthogonal function- ality to what the Conan recipes implement. These plugins can be shared, managed and installed via this case, as our project uses CMake as the build system, we call to cmake_layout(). Calling this function will set the expected locations for a CMake project. • The generate() method prepares the build0 码力 | 769 页 | 4.69 MB | 1 年前3
共 347 条
- 1
- 2
- 3
- 4
- 5
- 6
- 35













