WTF Bites
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
-
Why are you writing your emails in bright green?!
Do we have the same colleagues?
PS: try reading that on a dark background / dark theme.
Sounds great! Amber CRTs always seemed like a mistake.
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
This not having any particular effect or meaning on my physiology I must needs catch as catch can.
Partway through a litany of trivial yet vulgar boxers, I wonder why this code was suspected of optimization.
<reel missing>
In closing, aaaaagh fuck this.
-
Partway through a litany of trivial yet vulgar boxers, I wonder why this code was suspected of optimization.
Yeah, wasn't going to accuse it of being optimized either. Premature maybe.
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
This not having any particular effect or meaning on my physiology I must needs catch as catch can.
Partway through a litany of trivial yet vulgar boxers, I wonder why this code was suspected of optimization.
Optimization in all the wrong places of course.
(*p == '_') || (*p == '-')
and then using a stringstream instead of hackingNUL
s right into the read buffer.
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
This not having any particular effect or meaning on my physiology I must needs catch as catch can.
Partway through a litany of trivial yet vulgar boxers, I wonder why this code was suspected of optimization.
Optimization in all the wrong places of course.
(*p == '_') || (*p == '-')
and then using a stringstream instead of hackingNUL
s right into the read buffer.Pretty sure the efficiency vs a table lookup was an accident of ignorance.
-
-
@HardwareGeek said in WTF Bites:
@cvi quoted @Gribnitwit in WTF Bites:
trivial yet vulgar boxers
I'm wondering if I can get some commissioned and consecrated as Holy Garments. 😈
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
.. it's not even that long.
Yeah, wasn't going to accuse it of being optimized either. Premature maybe.
It's clearly “optimized” for learning time. Why learn a parser generator when he can just hand-roll the parser.
Optimization in all the wrong places of course.
(*p == '_') || (*p == '-')
and then using astringstream
instead of hackingNUL
s right into the read buffer.The C++ string functions generally take length or end pointer, so he wouldn't even have to hack any NULs in it.
That said,
string_view
was only added in C++17, and when I tried to use it for something earlier this year, I cursed it all the way to hell, because it lacks half the methods and conversions it should have.
-
That said,
string_view
was only added in C++17, and when I tried to use it for something earlier this year, I cursed it all the way to hell, because it lacks half the methods and conversions it should have.So does
string
proper. It's called being consistent.
-
-
table lookup
That's our code. Table lookups for utf8 decoding and case folding. I'll look into better solutions when it becomes a performance hotspot.
-
That said,
string_view
was only added in C++17, and when I tried to use it for something earlier this year, I cursed it all the way to hell, because it lacks half the methods and conversions it should have.So does
string
proper. It's called being consistent.Except it isn't, because
string_view
does not have even some things thatstring
does. But the main problems are:string_view
does not have conversion fromstring
, so you can't just takestring_view
argument and have any ofstring_view
,string
orchar *
convert depending on what the caller has.- A bunch of functions that take
string
didn't getstring_view
overload, so you have to create additional copy in a bunch of places just because of the type mismatch.
-
string_view
does not have conversion fromstring
string
does have a conversion tostring_view
. Not sure why they chose to do it with a conversion operator instead of a constructor, but I assume it's about the direction of dependencies, i.e.,string_view
is the more fundamental type and should know nothing ofstring
, while the other is bigger and can easily have a dependency.
-
string_view does not have conversion from string, so you can't just take string_view argument and have any of string_view, string or char * convert depending on what the caller has.
Edit: 'd
Edit2:
A bunch of functions that take string didn't get string_view overload, so you have to create additional copy in a bunch of places just because of the type mismatch.
This is a problem, though. And it goes a bit further than that. If you want to use any API that uses standard C strings (i.e., strings terminated with NUL), you have to convert away from
string_view
, becausestring_view
's data pointer isn't necessarily nul-terminated. Most OS-APIs expect nul-terminated strings; few take pointer+length.
-
If you want to use any API that uses standard C strings (i.e., strings terminated with NUL), you have to convert away from string_view, because string_view's data pointer isn't necessarily nul-terminated. Most OS-APIs expect nul-terminated strings; few take pointer+length.
But that's something that's impossible to solve with
string_view
. If your data isn't nul-terminated, you need a copy, which defeats the purpose of a fast view. Of course you could define something likezstring_view
solely for interacting with C stuff, but then you can't take arbitrary substrings.
-
@topspin iirc, things that do very heavy string handling don't use
string
s anyway, custom structures like "ropes" get involved.
-
@cvi I don't want C strings. I understand why that's a problem. I just want the C++ ones.
-
@Gribnit https://github.com/DanielAdolfsson/ndppd/blob/master/src/conf.cc & https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc
If you need a slightly less painful way of wasting your time, I ran recommend hitting your fingers with a hammer. Repeatedly.
.. it's not even that long.
Yeah, wasn't going to accuse it of being optimized either. Premature maybe.
It's clearly “optimized” for learning time. Why learn a parser generator when he can just hand-roll the parser.
Optimization in all the wrong places of course.
(*p == '_') || (*p == '-')
and then using astringstream
instead of hackingNUL
s right into the read buffer.The C++ string functions generally take length or end pointer, so he wouldn't even have to hack any NULs in it.
Nah, just don't use any C++ string stuff, NUL-terminate stuff in the buffer and save a pointer to it. Optimization!!11
-
Most OS-APIs expect nul-terminated strings; few take pointer+length.
The OS APIs that tend to need performance take pointer and length. You don't need that much performance for the others; the cost of listing a directory far exceeds the cost of copying the (directory) filename used to start the reading.
-
Most OS-APIs expect nul-terminated strings; few take pointer+length.
The OS APIs that tend to need performance take pointer and length. You don't need that much performance for the others; the cost of listing a directory far exceeds the cost of copying the (directory) filename used to start the reading.
The OS APIs that take pointer and length tend to use them for output strings; input strings tend to still be NUL-terminated, with most exceptions being in APIs dedicated to string manipulation.
-
@Medinoc OS APIs which provide you a string (in linux) always take the copy hit since they'll be copying the strings from kernel space to user space. Though I guess it does mean you need to spend extra userspace time to calculate the string length.
-
As they say: A man with a clock knows what time it is. A man with two clocks is never sure.
(Dual monitor screenshot, click to embiggen)
Great way to miss appointments.
-
@topspin Clearly, the correct time is the average time displayed by all clocks which is this case would be... counts ...end of workday time! Woo!
-
@topspin How in the nine fucks did that happen?
-
I want to know, and at the same time, I'm pretty sure that the answer will terrify me.
-
-
@topspin How in the nine fucks did that happen?
I have no idea.
My guess would be something something power saving, but .
-
@Zerosquare the answer can be found, of course, in the Book of Five Rings. Legend has it that Hesse University’s Dresden campus has the most accurate copy.
-
@Zerosquare the answer can be found, of course, in the Book of Five Rings. Legend has it that Hesse University’s Dresden campus has the most accurate copy.
I must be terribly ing, but Dresden is in Saxony.
-
@topspin Hanzo is the keeper of the Book of Five Rings, and he stalks across the Dresden campus of Hesse University, like a ninja in the night.
-
@topspin Hanzo is the keeper of the Book of Five Rings, and he stalks across the Dresden campus of Hesse University, like a ninja in the night.
An IT administrator without peer, Hanzo is tireless in his care for the university's infrastructure, the silent guardian of... Dresden's files.
-
@topspin How in the nine fucks did that happen?
One of the screens has a really shitty refresh rate.
-
@cvi don't crap on e-ink
-
Just got a big blast from the past: I was reading something and suddenly, Firefox just *pop* disappeared and threw up the crash reporter window
-
Most OS-APIs expect nul-terminated strings; few take pointer+length.
The OS APIs that tend to need performance take pointer and length. You don't need that much performance for the others; the cost of listing a directory far exceeds the cost of copying the (directory) filename used to start the reading.
The OS APIs that take pointer and length tend to use them for output strings; input strings tend to still be NUL-terminated, with most exceptions being in APIs dedicated to string manipulation.
Input is by giving a buffer (and length) and getting back how many bytes of that buffer were written by the read operation. The C library wraps that in stuff that looks more like working with C strings, but the OS is more efficient. It might copy the data in kernel space, or it might present it directly to the hardware. Network packets are definitely copied because ethernet is a piece-of-shit-protocol () but disks might not need to. (Kernels are quite free to adapt what strategy to use based on exact details.)
-
@topspin Your desktop is so wide that one end of it is in a different timezone to the other?
-
@topspin Your desktop is so wide that one end of it is in a different timezone to the other?
I know timezones are weird, but even they're not that weird!
-
@topspin Your desktop is so wide that one end of it is in a different timezone to the other?
I know timezones are weird, but even they're not that weird!
This could occur with any sized desktop, the edge of a timezone has no dimension.
-
@Gribnit seems like it ought to have at least one.
-
@boomzilla said in WTF Bites:
@Gribnit seems like it ought to have at least one.
-
Just got a text for PG&E warning there's an outage in my area. And I might be affected.
<voice>He's not.</voice>I go and look at the outage map. The closest outage is about 50 miles away. Where the fuck do they think I live.
update: As I was typing, I get another text "Outage including ..."
<voice>He still has power.</voice>Looks at outage map again. Ah, there is an outage. About 2 miles away. They still don't seem to know where I live...
-
@dcon rain to end.
-
@topspin Your desktop is so wide that one end of it is in a different timezone to the other?
Only Putin's desktop is.
-
-
@Tsaukpaetra said in WTF Bites:
Where the fuck do they I live.
They don't.
They do. You'll see. Put on these sunglasses.
-
-
WTF of my day: Did you know that to run unit tests for an iOS app that in no way touch the UI or UI classes, you have to either
- have a physical device plugged in and unlocked (and set up for dev)
- or have a simulator open
And the test runner will actually launch the app (with all the time/etc required) when you execute the test case? And there is no Apple-supported (ie not utter hack) way of avoiding this?
-
@Benjamin-Hall said in WTF Bites:
WTF of my day: Did you know that to run unit tests for an iOS app that in no way touch the UI or UI classes, you have to either
- have a physical device plugged in and unlocked (and set up for dev)
- or have a simulator open
And the test runner will actually launch the app (with all the time/etc required) when you execute the test case? And there is no Apple-supported (ie not utter hack) way of avoiding this?
is thread is
-
@Zerosquare said in WTF Bites:
I want to know, and at the same time, I'm pretty sure that the answer will terrify me.
You have requested an answer from my domain. This most likely resulted from running a VM that drifted, which they will do given various available kernel-level fuckups.