| Deutsch English Français Italiano |
|
<20240913120417.0000146c@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.arch
Subject: Re: Computer architects leaving Intel...
Date: Fri, 13 Sep 2024 12:04:17 +0300
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <20240913120417.0000146c@yahoo.com>
References: <2024Aug30.161204@mips.complang.tuwien.ac.at>
<memo.20240830164247.19028y@jgd.cix.co.uk>
<vasruo$id3b$1@dont-email.me>
<2024Aug30.195831@mips.complang.tuwien.ac.at>
<vat5ap$jthk$2@dont-email.me>
<vaunhb$vckc$1@dont-email.me>
<vautmu$vr5r$1@dont-email.me>
<2024Aug31.170347@mips.complang.tuwien.ac.at>
<vavpnh$13tj0$2@dont-email.me>
<vb00c2$150ia$1@dont-email.me>
<505954890d8461c1f4082b1beecd453c@www.novabbs.org>
<vb0kh2$12ukk$1@dont-email.me>
<vb3smg$1ta6s$1@dont-email.me>
<vb4q5o$12ukk$3@dont-email.me>
<vb7b0v$3d1o7$1@dont-email.me>
<20240912231016.00004048@yahoo.com>
<86a5gcfich.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Sep 2024 11:04:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="46d778e366440aa5cd4ab92ae9134f42";
logging-data="479852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p5ZE6fwd/NfYCL6mGAdMoEoRU6fSk4r0="
Cancel-Lock: sha1:Xe5SDXHOiI5L0z6gVO2s0SXstV0=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
Bytes: 3886
On Thu, 12 Sep 2024 18:33:18 -0700
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Michael S <already5chosen@yahoo.com> writes:
>
> > On Tue, 3 Sep 2024 17:46:38 +0200
> > Terje Mathisen <terje.mathisen@tmsw.no> wrote:
> >
> >> Q&D programming is still far faster for me in C, but using Rust I
> >> don't have to worry about how well the compiler will be able to
> >> optimize my code, it is pretty much always close to speed of light
> >> since the entire aliasing issue goes away.
> >
> > I am trying to compare speed of few compiled languages in one
> > benchmark that I find interesting.
> > In order to make comparison I have to port a test bench first,
> > because while most of this languages are able, with various level of
> > difficulties, to call C routines, none of them can be called from
> > 'C', at least at my level of knowledge.
> >
> > Porting test bench from C to Go was quite easy, the only part that I
> > didn't grasp immediately was related to time measurements.
> >
> > Today I started Rust port and it is VERY much harder. After several
> > hours of reading of various tutorials, examples and Stack Overflow
> > articles I still don't know how to write
> > switch (argv[1][0]) {
> > case 't':
> > case 'T':
> > x = 42;
> > break;
> > }
> >
> > At this rate, I am not sure that my motivation will last long
> > enough to finish the porting.
>
> Disclaimer: I have very little experience with Rust. The
> example shown below looks like Rust but may very well have
> syntax errors (or worse).
>
> match argv[1][0] {
> 't' | 'T' => { x = 42; }
> _ => { }
> }
>
> The _ pattern matches anything that hasn't been matched (and
> may be necessary, I'm not sure about that).
My hardle is relatedd to [0] part rather than to switch/case part.
Accessing nth character of String (or of str? Or &str ? I am still
trying to figure out the difference.) is not as simple as in C or Go.
One person on Stack Overflow said that he was able to figure it out
after he learned the difference between std::string and
std::string_view in C++. May be, I should follow the same process. But
I don't want to. I don't plan to become an expert Rust programmer,
but rather want to do a simple benchmark.