Load site modules...
lade...
random avatar

glloyd - Network

Posts Subscribe

Jack Simms did an amazing talk about talking. In the middle, they also re-did a mini talk. All of it was SO good.#accuconf

https://fosstodon.org/@glloyd/11...

Jack Simms did an amazing talk about talking. In the middle, they also re-did a mini talk. All of it was SO good.

4.4.2025 12:44Jack Simms did an amazing talk about talking. In the middle, they also re-did a mini talk. All of it was SO good.#accuconf
https://fosstodon.org/@glloyd/11...

@anthonywilliams Great talk, thank you.#accuconf

https://fosstodon.org/@glloyd/11...

@anthonywilliams
Great talk, thank you.

4.4.2025 10:10@anthonywilliams Great talk, thank you.#accuconf
https://fosstodon.org/@glloyd/11...

Last night at #accuconf was great.- Did a lightning talk ⚡️- Went climbing with some other attendees 🧗- Drinks and chatting with...

https://fosstodon.org/@glloyd/11...

Last night at was great.
- Did a lightning talk ⚡️
- Went climbing with some other attendees 🧗
- Drinks and chatting with other attendees 🍻

3.4.2025 07:26Last night at #accuconf was great.- Did a lightning talk ⚡️- Went climbing with some other attendees 🧗- Drinks and chatting with...
https://fosstodon.org/@glloyd/11...

Have you ever been working on part of a system which, taken in isolation, looks completely insane?#programming #AccuConf #AccuConf2025

https://fosstodon.org/@glloyd/11...

Have you ever been working on part of a system which, taken in isolation, looks completely insane?

30.3.2025 17:03Have you ever been working on part of a system which, taken in isolation, looks completely insane?#programming #AccuConf #AccuConf2025
https://fosstodon.org/@glloyd/11...

I have no idea what coach I'm in. I have no idea how to find my seat.

https://fosstodon.org/@glloyd/11...

I have no idea what coach I'm in. I have no idea how to find my seat.

30.3.2025 10:23I have no idea what coach I'm in. I have no idea how to find my seat.
https://fosstodon.org/@glloyd/11...

Travel to #accuconf looking good so far (sarcasm)**grumble grumble trains something grumble grumble**

https://fosstodon.org/@glloyd/11...

Travel to looking good so far (sarcasm)

**grumble grumble trains something grumble grumble**

30.3.2025 09:56Travel to #accuconf looking good so far (sarcasm)**grumble grumble trains something grumble grumble**
https://fosstodon.org/@glloyd/11...

A solutionThis is my solution:https://godbolt.org/z/hMxzhd6fT

https://fosstodon.org/@glloyd/11...

A solution


This is my solution:
godbolt.org/z/hMxzhd6fT

29.3.2025 22:02A solutionThis is my solution:https://godbolt.org/z/hMxzhd6fT
https://fosstodon.org/@glloyd/11...

C++ hint 10`std::string::iterator` is more or less the same as `char *`, so for performance you need to be aware of the strict aliasing...

https://fosstodon.org/@glloyd/11...

C++ hint 10


`std::string::iterator` is more or less the same as `char *`, so for performance you need to be aware of the strict aliasing rule.

Basically any write to a `char *` would invalidate any assumptions read being invariant between loop iterations. Hence a read in a loop that you know doesn't change, and you maybe assumed to be optimised to read once, that assumption is wrong. The compiler can't assume that and would have to read on every iteration.

29.3.2025 21:40C++ hint 10`std::string::iterator` is more or less the same as `char *`, so for performance you need to be aware of the strict aliasing...
https://fosstodon.org/@glloyd/11...

C++ hint 9Did you spell out the whole type `std::string::iterator`?Try using `auto`

https://fosstodon.org/@glloyd/11...

C++ hint 9


Did you spell out the whole type `std::string::iterator`?

Try using `auto`

29.3.2025 19:13C++ hint 9Did you spell out the whole type `std::string::iterator`?Try using `auto`
https://fosstodon.org/@glloyd/11...

Code design hint 1Did you optimize for a particular case?If so why? Is it expected that the string would be empty or have only one word?

https://fosstodon.org/@glloyd/11...

Code design hint 1


Did you optimize for a particular case?

If so why? Is it expected that the string would be empty or have only one word?

29.3.2025 19:11Code design hint 1Did you optimize for a particular case?If so why? Is it expected that the string would be empty or have only one word?
https://fosstodon.org/@glloyd/11...

C++ hint 8This is just a style choice. Not good or bad.Have you tried std::begin(str), std::end(str), std::next(it), rather than...

https://fosstodon.org/@glloyd/11...

C++ hint 8


This is just a style choice. Not good or bad.

Have you tried std::begin(str), std::end(str), std::next(it), rather than str.begin(), str.end(), it+1

What about if you use ADL so that you don't need to have the std namespace?

29.3.2025 19:09C++ hint 8This is just a style choice. Not good or bad.Have you tried std::begin(str), std::end(str), std::next(it), rather than...
https://fosstodon.org/@glloyd/11...

C++ hint 7Do variables have good names?Is there a duality between a pair of variables? If so are they named consistently?

https://fosstodon.org/@glloyd/11...

C++ hint 7


Do variables have good names?

Is there a duality between a pair of variables? If so are they named consistently?

29.3.2025 19:06C++ hint 7Do variables have good names?Is there a duality between a pair of variables? If so are they named consistently?
https://fosstodon.org/@glloyd/11...

C++ hint 6Have you put `const` on everything you can?

https://fosstodon.org/@glloyd/11...

C++ hint 6


Have you put `const` on everything you can?

29.3.2025 19:04C++ hint 6Have you put `const` on everything you can?
https://fosstodon.org/@glloyd/11...

C++ hint 5Are you testing a very similar condition twice in a hot loop?Try an infinite loop and put the test and break only at the point you...

https://fosstodon.org/@glloyd/11...

C++ hint 5


Are you testing a very similar condition twice in a hot loop?

Try an infinite loop and put the test and break only at the point you require.

29.3.2025 19:04C++ hint 5Are you testing a very similar condition twice in a hot loop?Try an infinite loop and put the test and break only at the point you...
https://fosstodon.org/@glloyd/11...

C++ hint 4Did you use std::isspace?That maybe too heavy weight.It is a call to a C function, so not inline-able (bad for performance). Also...

https://fosstodon.org/@glloyd/11...

C++ hint 4


Did you use std::isspace?
That maybe too heavy weight.

It is a call to a C function, so not inline-able (bad for performance). Also would return true for stuff that wasn't a space character.

29.3.2025 19:01C++ hint 4Did you use std::isspace?That maybe too heavy weight.It is a call to a C function, so not inline-able (bad for performance). Also...
https://fosstodon.org/@glloyd/11...

C++ hint 3Did you use any std::string::find* methods? And have to deal with std::string::npos? This is practically same as using indices....

https://fosstodon.org/@glloyd/11...

C++ hint 3


Did you use any std::string::find* methods? And have to deal with std::string::npos? This is practically same as using indices.

Maybe better to just use iterators.

29.3.2025 18:58C++ hint 3Did you use any std::string::find* methods? And have to deal with std::string::npos? This is practically same as using indices....
https://fosstodon.org/@glloyd/11...

C++ hint 2Did you extract anything into a function?Did you give it a good name?Have a look in `#include <algorithm>` does it already...

https://fosstodon.org/@glloyd/11...

C++ hint 2


Did you extract anything into a function?
Did you give it a good name?

Have a look in ` <algorithm>` does it already exist?

en.cppreference.com/w/cpp/algo

29.3.2025 18:55C++ hint 2Did you extract anything into a function?Did you give it a good name?Have a look in `#include <algorithm>` does it already...
https://fosstodon.org/@glloyd/11...

C++ hint 1Are you using indices?e.g. str[i]Did you have random +1 or -1 modifiers to get to correct index? Or even worse +2 or -2?Try using...

https://fosstodon.org/@glloyd/11...

C++ hint 1


Are you using indices?
e.g. str[i]

Did you have random +1 or -1 modifiers to get to correct index? Or even worse +2 or -2?

Try using iterators and think about leaning into the idea of half open interval

auto b = str.begin();
auto e = str.end();

The half open interval for the string being [b, e)

29.3.2025 18:30C++ hint 1Are you using indices?e.g. str[i]Did you have random +1 or -1 modifiers to get to correct index? Or even worse +2 or -2?Try using...
https://fosstodon.org/@glloyd/11...

Algorithm hint 2This exercise is not about if can you imagine the smart/best algorithm. The image shows the approach to do it in O(n) time,...

https://fosstodon.org/@glloyd/11...

Algorithm hint 2


This exercise is not about if can you imagine the smart/best algorithm. The image shows the approach to do it in O(n) time, O(1) space.

Now go write good C++

29.3.2025 18:25Algorithm hint 2This exercise is not about if can you imagine the smart/best algorithm. The image shows the approach to do it in O(n) time,...
https://fosstodon.org/@glloyd/11...

Algorithm hint 1This can be done in O(n) time and O(1) space

https://fosstodon.org/@glloyd/11...

Algorithm hint 1


This can be done in O(n) time and O(1) space

29.3.2025 18:19Algorithm hint 1This can be done in O(n) time and O(1) space
https://fosstodon.org/@glloyd/11...
Subscribe
To add news/posts to your profile here, you must add a link to a RSS-Feed to your webfinger. One example how you can do this is to join Fediverse City.
         
Webfan Website Badge
Nutzungsbedingungen   Datenschutzerklärung  Impressum
Webfan | @Web pages | Fediverse Members

⬆️

⬇️