C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Fwd: Proposal for improving the C/C++ language, to get higher performance
From: Peter Sommerlad (C++) (peter.cpp_at_[hidden])
Date: 2021-01-18 03:31:09


Dear Wesley,

I have a hard time to understand what you are actually suggesting.

Please prepare a Tony-Table to show before/after what code would look
like with your proposal.

 From a gut feeling, I think you are trying to change stuff in the
language, that is in the realm of compiler optimizers.

Regards
Peter.

Wesley Oliver via Std-Proposals wrote on 17.01.21 13:52:
>
>
> Hi,
>
> I would like to propose an improvement to the C and well c++ language,
> because I believe it should be available in both languages that would
> allow us to write more performant code in a Higher Level language
> without having to write assemble level or low-level c with assemble.
>
> I have proposed typically something similar to javascript, however, this
> applies to all languages
> c, c++ as limitation of all them, goto doesn't hit the mark, comes up a
> little short.
> In c, c++ inline would probably get one near there with compiler
> optermizations, but it is still not a great way to write code.
>
> I would like to allow loops structures, to do what I describe below, but
> basically the same applies for c/c++, however, one would be using
> explicit function inlining.
>
> Typically I am sure that there would be many solutions of comparison,
> where we would be able to start taking advantage of this to improve the
> speed of algorithms,
> which currently high level languages basically limit.
>
> https://es.discourse.group/t/achive-higher-performent-solutions-with-greater-high-level-control-of-break-num-label-continue-skip-equivalent-of-low-level-goto-with-block-chain-of-statments/619
>
> https://sites.google.com/site/wiprogamming/Home/developer-blog
>
> 07 April 2020 - Additional Native Ptr BitMap Flags bit position to int
> or ptr, value and visa versa visa for languages and CPU
> <https://docs.google.com/document/d/1VlxUG9Cvp3YPRyF_CdCkGeGgRyGA0GDp3miDJElAbT4/edit?usp=sharing>
>
>
> Also thinking about it stepping a pointer onwards and de-referencing to
> access the value, I think could also have special optimization, to look
> at making this one operation stepAndLoadValue, but I would have go and
> check the instruction set of various process, but definitely benefit
> from that
> I have go check them out and arm instruction set.
> may need a char^ like in delphi, but means variable acts like a pointer,
> however, pair with its dereferenced version, possibly lazy evaluated.
> That would save me from have to have to variables here to reduce the
> double dereferencing, it's simpler to work with a variable
> that have both accessible, thinking maybe look like an iterator, first,
> second. concept, to keep backwards compatibility with operators.
> the wrapping class could then just simplify things and reduce require
> number of variables for optimal performance.
>
> Overall this reduce the number of if statements and things and allows
> for faster branch prediction.
> Typicaly have string which are null terminated, is much faster as
> reduces all underlying checks. well at least other languages,
> c is not doing that but still, wanting the most performant code.
>
> *Example:
> *
> function match(char* str) {
>
> char* matchme = "matchme\0";
>
> let countMatch = 0;
>
> for(char* ch = str, char chd = ch*;chd != '\0';ch++, chd = *ch)
> {
>   // could make this an inline function.
>
>   char* chs = str, char chds   = chs*;
>   char* mech = matchme, char mechd = *mech ;
>   while(true)  { // sure that by now compiler optermized, could just
> say loop
>      if (chds != mechd) {
>         if(mechd == '\0')   {
>            break;
>           continue; // kicks out of the loop and skip the rest of the
> parent look code, for a case that fail, in the case of successfully
> match, then countMatch++ will execute.
>        }
>      }
>   mech++; mechd = * mech;    chs++; chds = *chs ;
>   }
>   countMatch++;
> }
> }
>
>
> Kind Regards,
>
> Wesley Oliver
>
>
>
> --
> ----
> GitHub:https://github.com/wesleyolis
> LinkedIn:https://www.linkedin.com/in/wesley-walter-anton-oliver-85466613b/
> Blog/Website:https://sites.google.com/site/wiprogamming/Home
> Skype: wezley_oliver
> MSN messenger: wesley.olis_at_[hidden] <mailto:wesley.olis_at_[hidden]>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
> <#m_-1762488501658346478_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>
> --
> ----
> GitHub:https://github.com/wesleyolis
> LinkedIn:https://www.linkedin.com/in/wesley-walter-anton-oliver-85466613b/
> Blog/Website:https://sites.google.com/site/wiprogamming/Home
> Skype: wezley_oliver
> MSN messenger: wesley.olis_at_[hidden] <mailto:wesley.olis_at_[hidden]>
>
>

-- 
Peter Sommerlad
Better Software: Consulting, Training, Reviews
Modern, Safe & Agile C++
peter.cpp_at_[hidden]
+41 79 432 23 32

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups