Path: ...!weretis.net!feeder8.news.weretis.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail From: Student Project Newsgroups: comp.lang.c++ Subject: constexpr is really very smart! Date: Sun, 15 Dec 2024 20:20:42 +0000 Organization: To protect and to server Message-ID: Mime-Version: 1.0 Content-Type: text/plain; Content-Transfer-Encoding: 7bit Injection-Date: Sun, 15 Dec 2024 20:24:43 -0000 (UTC) Injection-Info: paganini.bofh.team; logging-data="2643358"; posting-host="oUS9mq3vau9wu0ueCXkkJg.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A"; Content-Language: tk X-Notice: Filtered by postfilter v. 0.9.3 Bytes: 1493 Lines: 23 The constexpr is really very smart because it can speed up algorithms 1000 times according to Dave, Microsoft retired engineer. He has proved it by creating this video: On my computer it took 270 microseconds to calculate fib(35) like in his example. It was almost instant at the blink of the eyes. > D:\CmdLine\C_Cpp\Chrono02>program > Fibonacci_c: 9227465 > Time Taken: 270 > D:\CmdLine\C_Cpp\Chrono02>program > Fibonacci_c: 9227465 > Time Taken: 257 > D:\CmdLine\C_Cpp\Chrono02>program > Fibonacci_c: 9227465 > Time Taken: 171 > D:\CmdLine\C_Cpp\Chrono02>program > Fibonacci_c: 9227465 > Time Taken: 176 Amazing.