Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Over the shoulder supervision is more a need of the manager than the programming task.


devel / comp.lang.c++ / What do you think ?

SubjectAuthor
o What do you think ?Bonita Montero

1
What do you think ?

<ubio7t$3b9bp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=1023&group=comp.lang.c%2B%2B#1023

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: What do you think ?
Date: Wed, 16 Aug 2023 16:59:10 +0200
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ubio7t$3b9bp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 16 Aug 2023 14:59:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="968e0a5f39da2f43ea5079336edb49b8";
logging-data="3515769"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182wr65gpIMZk8nSzxLXBQBwtybMTnbBbM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:D3b58XuarTZ8sZN78r9IJeHcjVI=
Content-Language: de-DE
 by: Bonita Montero - Wed, 16 Aug 2023 14:59 UTC

#include <iostream>
#include <chrono>
#include <vector>
#include <intrin.h>

using namespace std;
using namespace chrono;

int main()
{ constexpr size_t
ROUNDS = 10'000,
BITS = 1'000'000;
auto tFn = []( char const *prefix, auto fn )
{
auto start = high_resolution_clock::now();
fn();
cout << prefix << duration_cast<nanoseconds>(
high_resolution_clock::now() - start ).count() / 1.0e9 << endl;
};
tFn( "BTS: ", [&]()
{
vector<char> vc( (BITS + 7) / 8, 0 );
long *data = (long *)vc.data();
for( size_t r = ROUNDS; r--; )
for( size_t i = 0; i < BITS; i += 7 )
_bittestandset( data, (long)i );
} );
tFn( "vector<bool>: ", [&]()
{
vector<bool> vb( BITS );
for( size_t r = ROUNDS; r--; )
for( size_t i = 0; i < BITS; i += 7 )
vb[i] = true;
} );

}

I'm testing a bool-vector against a vector<char> and x86's BTS
instruction through the MSVC-intinsic. Which code is faster ?


devel / comp.lang.c++ / What do you think ?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor