Originally posted by pal666
View Post
Announcement
Collapse
No announcement yet.
Another Potential CPU Optimization For Mesa: Quadratic Probing
Collapse
X
-
- Likes 2
-
Originally posted by marek View Post
No, C++ standard containers are not designed for speed. I actually wanted to add a note that C++ STL is an example of such a library. std::list is an example of a really bad design, because it allocates memory for every list node that just contains a pointer to the item. "list_head" in kernel/mesa never allocates memory for nodes. To this day, C++ doesn't have a standard linked list implementation worth using.
- Likes 1
Comment
-
Originally posted by marek View Post
No, C++ standard containers are not designed for speed. I actually wanted to add a note that C++ STL is an example of such a library. std::list is an example of a really bad design, because it allocates memory for every list node that just contains a pointer to the item. "list_head" in kernel/mesa never allocates memory for nodes. To this day, C++ doesn't have a standard linked list implementation worth using.
But I heard std::vector's API sucks too (for subtle reasons like a no-invalidation guarantee on move).
Comment
-
Originally posted by Ancurio View Post
Well, there is a difference between plain linked lists and intrusive lists std::list might be horrible, but it allows working with structs whose definition you can't modify.
The functionality provided by std is often very generic, which indeed can come with a performance cost.
Comment
-
You can still use C++ in the C way with all benefits of template metaprogramming or static type checking and other fancy things... even on microcontrolles like dat small atmega88PA with 8 KiB of flash memory and 1 KiB of ram... the output binary size is same or even less in some more complex projects... And the C++ static code analysis is fkin dope it saved my quadcopter project few times... just dont use malloc and similar bullshit and there is no STL in the 8 bit port... If you have language with stricter rules or better type system than simple C compiler can do smarter optimizations for you while keeping the code simple and clean.
Look at the zero overhead abstractions (CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”)
He is probably compiling with clang but gcc can do some magic too
- Likes 1
Comment
-
Originally posted by debianxfce View Post
Rust, Java, etc. are for sleeping people. A person who creates buffer overflows and null pointer assignments should not be in the industry. When you compile C, it is closest to the assembly language than any other human readable programming language. That is why C is popular in the driver development, for example arduino is quite new platform and you use C.
If Rust, or another safe (not Java, the JVM has issues) language, were available on the chip we use as our controller, you can damn well bet we'd be using it. You don't play dick-waving contests with people's lives.
- Likes 2
Comment
-
-
-
Originally posted by marek View Post
They are used everywhere in the kernel and Mesa. It's the most used and also the fastest data structure for non-trivial objects.I mean the kernel and Mesa version of the linked list.Last edited by indepe; 09 February 2017, 05:15 PM.
Comment
Comment