C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Callsite passed as template parameter

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Thu, 16 Nov 2023 21:38:33 +0100
czw., 16 lis 2023 o 12:39 Frederick Virchanza Gotham via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> On Thu, Nov 16, 2023 at 10:19 AM Jonathan Wakely <cxx_at_[hidden]> wrote:
> >
> > OK, but not suitable for the C++ standard. This isn't a mailing list for sharing your cool ideas.
>
>
> Are you saying that the C++ standard shouldn't accommodate
> microcontrollers, or that the C++ standard shouldn't accommodate
> micro-optimisation?
>

Are you aware that the thing you propose is opposite of this?
Do you know that each function `static` needs lock and it's not free.
Or at least condition variable to check if the value was already initialized.

In many cases a lot better would be pure `std::array` (or static vector)
on stack and have a bigger stack to accommodate all data like this.
This would have another benefits that program will not waste memory
for things that are used only in one case and many "cases" have no
overlapping lifetime.

> Last Thursday I was at a C++ talk in Belfast by Jason McGuiness where
> he was talking about writing template state machines to take advantage
> of the x86 instruction:
>
> call qword pointer [ immediate + immediate * register ]
>
> instead of using an 'if else' ladder. He was trying to shave off CPU
> cycles in his code for low latency financial trading systems. People
> are actually doing that.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-11-16 20:38:45