3 ms·
> but it's still a pleasure for me to write and have to deal with C But wouldn't you love a C with things like first class support for arrays and support for n
by nicoburns 7y ago
> but it's still a pleasure for me to write and have to deal with C
But wouldn't you love a C with things like first class support for arrays and support for namespaces / modules, etc.
- scoutt 7y agoWith years you get to put together a swiss-army toolset of libraries to deal with all that (like arrays, strings, etc.). You know how they work, how far you can push them, the overhead, and all. Do I really know how much cycles/stack it takes to do std::sort(a.begin(), a.end()); in that specific platform? No, so I cannot trust it. I know it's reinventing the wheel, but I am sure that there are known simple libraries out there one can use. I use mine. What I would like is a better precompiler, like assigning dynamic values to constants. But I won't change the language for that.
- hurrrrrrrr 7y ago>Do I really know how much cycles/stack it takes to do std::sort(a.begin(), a.end()); in that specific platform? No, so I cannot trust it. I also don't know how many cycles it takes for my implementation of quicksort apart from checking the output of a specific compiler and counting instructions. C is not, was not and will never be a portable assembler.
- deleted 7y ago[deleted]
- cwzwarich 7y ago> I also don't know how many cycles it takes for my implementation of quicksort apart from checking the output of a specific compiler and counting instructions. On any modern out-of-order CPU, that doesn't get you close to determining the dynamic performance. Even with full knowledge of private microarchitectural details, you'd still have a hard time due to branch prediction.
- whatshisface 7y agoOn most (small, I'm not talking about mini linux) embedded systems, instruction counting will tell you how long something takes to run. In fact, the compilers available are often so primitive that operation counting in the source code can sometimes tell you how long something will take.
- AstralStorm 7y agoOn most embedded ARM it won't (out of order execution, caches, alignment), and they don't have to run Linux, likewise on common MIPS implementations. Simple predictability ends at 16-bit CPUs generally, and even those can be tricky if it's say m68k.
- loeg 7y ago"Most" embedded ARM? Cortex-A8 and smaller do not have OoO execution. Cortex-A9 is a 32-bit up-to-quad core CPU with clock of 800MHz-2GHz and 128k-8MB of cache. That's pretty big. I guess a lot of this is subject to opinion, but I don't think smartphones with GBs of RAM when I think of embedded systems.
- mlyle 7y agoEven e.g. A53 is in-order, and it's a 64 bit, pretty quick CPU (as seen in Raspberry Pi 2/3).
- mlyle 7y agoWhen I hear "embedded ARM", I hear "Cortex M". All of Cortex M is in-order and only M7-- still somewhat exotic-- has a real cache (silicon vendors often do some modest magic to conceal flash wait states, though). Alignment requirements are modest and consequences are predictable. Etc. About the most complicated performance management thing you get is the analysis of fighting over the memory with your DMA engine. And even that you can ignore if you're using a tightly coupled memory...
- archi42 7y ago
- jdc 7y agoDoesn't C model the PDP-11 more so than ARM or x86?
- baybal2 7y agoThere is a language called D
- yvdriess 7y agoD -betterC
- gonzus 7y agoI would. I am keeping an eye on the zig programming language, exactly because of these reasons: https://ziglang.org/ https://ziglang.org/