« first day (2010 days earlier)      last day (3164 days later) » 

00:03
anyone good at struct weak ordering ?
strict** :p
you can edit messages you know
Yes i forgot, sorry. I'll remember that next time :)
I'm testing out how to define a custom comp method for multimap, but since the key is a struct its a little more difficult than i expected. I'm trying out suggestions I've found on google but still not found one that works.

any ideas?
https://codeshare.io/qxLRs
maybe i should create a stack question
00:19
Why cant you just do return std::tie(a, b, ...) < std::tie(other.a, other.b, ...); ?
I use a tied function/lambda to avoid writing the member list twice
I never heard about this std::tie, ill give it a look!
also this makes it reusable in every other function which has a logic like "for every data member, do the following action"
@milleniumbug a function that takes a Foo (wtv your type is) and returns the result of std::tie?
00:22
so you can do return bar(*this) < bar(other);
wow that was so much simpler and it works
now i just gotta learn why it works :p anyways @Borgleader, thanks!!
@sciencefyll it creates a tuple
and tuple's operator< has strict weak ordering (afaik)
from the doc for tuple:
3-6) Compares lhs and rhs lexicographically, that is, compares the first elements, if they are equivalent, compares the second elements, if those are equivalent, compares the third elements, and so on.

All comparison operators are short-circuited; they do not access tuple elements beyond what is necessary to determine the result of the comparison.
so its basicaly just using tuple to do the dirty work fro you
then shouldnt it be std::tie(a.first, b.first) < std::tie(a.second, b.second)?
00:27
ill write it in the codeshare
the answer is no because that wouldnt compile if first and second dont have the same type
you'd essentially be writing std::tuple<int, int> < std::tuple<string, string>
everything is the same type, or do i missunderstand?
in your case maybe, but in the general case what you just wrote doesnt work
if you have struct { int first; string second; }; for example, you cant do std::tie(a.first, b.first) < std::tie(a.second, b.second)
yeah alright
and even with { string, string } this has wrong semantics
00:30
^ this, but it also just flat out wouldnt compile when types dont match
so its either wrong, or doesnt compile
01:18
Good thing I'm behind 7 proxies. https://twitter.com/socialcoroner/status/721457425082105856
time to get 7 proxies
01:50
lol
i just watched a guy that said there was something bigger than infinitive cause.. infinitive wasnt infinitive
I switched to python to make my life easier. I miss pass by reference. Also threading
&thats what she said
wait what?
My research paper got rejected from Science Transnational Medicine, where should I submit to next?
02:46
is there any explicit conversation between emoji and int? Since emoji is kind of unicode and unicode can be converted to int?
02:57
yes, the unicode number?
int main()
{
    return (int)'😱' ;
}
compilation warning
03:28
a warning is not an error
03:38
Fuck, why is everything easy in C++ hard is python
I was seduced by easy string manipulation
Why is a hammer bad at screwing things
What if everybody told you to use a hammer?
EVERYBODY SAID TO USE PYTHON
What's wrong with python
Poor multi threading performance with lots of weird work arounds
hard to pass data by reference
lol python and multithreading
03:42
:-(
All my software does it read a file, compute something in CUDA and write it back
and that runs like shit on Python, and the code is 4 times longer
I want my time back
that seems fairly trivial
are you using multiple devices?
Yeah, I have a producer consumer and a global IO cache
I had to do terrible things to get the global cache to work with multiprocessing
And your code is CPU-bound rather than GPU-bound? lol
Its IO bound
Although I have 24 hard drives
Just the crazy crazy stuff I had to do avoid deep copies
heh
well rewrite everything in seeplasplas
03:46
I'm about to
but I also have 40 hours before the thing is due
-.-
uni stuff or contract
graduate research
who cares then
My professor?
by that I mean you can always get more time to work on it later
03:48
Also, I have 70 bovine embryos that this thing needs to be ready to process. Else they die.
This is the computational backend for an in vivo embryo monitoring/ image acquisition system I built..
Anyways:
if your program really is IO bound then idk how you can get better performance with C++
Python does deep copies, lots of deep copies so pipe-lining gets fucked up
so it's CPU rather than IO
Its IO bound if you're using C++! CPU bound if your a fucking Python savage.
*you're (x2)
03:52
well then use C++ for fuck sake what are you waiting
too much code
can't rewrite
then give up and cry and tell your professor you made a terrible mistake
Nah, I'll just write shit code
and ask for another 24 hard drives
also panic
@Mikhail Then you use both. That way you're both CPU and IO bound.
03:59
I should acquire a religion that doesn't like snakes
(the snake in the picture is python 3.4)
lol
speaking of snakes I should reread Good Omens
s nake
Good morning
The weather here is awesome today.
Sunday Funday Goodday
04:43
@Mikhail doesn't make sense, what kind of person would extend hand towards a snake?
and the snake would slither away from the hand too
or bite it
@DmitriBudnikov Looks like my thread pool manages to deadlock in Linux.
I hadn't run unit tests on Linux in a long time. (I'm not sure if I've run them at all since I made my thread pool the default.)
Um...
I had a very consistent repro. But I disabled inlining for the thread worker and pool functions so it'd easier to debug... And it stopped deadlocking. Fuck.
 
2 hours later…
07:03
2 7+ magnitude earthquakes at 2 completely different places on earth within 48 hours!
im gonna watch a css tutorial
Riiight
& u r telling this to us because? >_<
Ven
Ven
He wants to become said tutorial.
@Telkitty chat was under 1 message per hour
we should watch out so the room does not get frozen for inactivity
07:18
rip lounge
I want to read a cinch tutorial
@VermillionAzure pls a link
07:59
@JohanLarsson the lounge thanks you 😂
08:14
Can't we just arbitrage karma from /r/ProgrammerHumor ?
user1804599
@JohanLarsson Watch a Sass tutorial afterwards.
@Zoidberg link one?
user1804599
No idea.
user1804599
@Ven can you use Sweet.js with TypeScript?
08:32
morning
I'm thinking no
08:48
Goddamn... Found what was causing the deadlock that only happens on Linux.
Had nothing to do with the thread pool itself.
How long time does an 1 ms computation take if you schedule it on the pool?
No idea. I've never measured the latency on the pool.
I've only cared about throughput and CPU utilization.
The latency would be difficult to measure anyway because of the randomization.
And the variance of context switches.
And the bug was a one-liner.
return (int)(64 - __builtin_clzll(x));
should have been:
return x == 0 ? 0 : (int)(64 - __builtin_clzll(x));
4 hours of debugging with gdb led to that.
Had I been able to repro it on Windows, I probably would've found it in about an hour.
not a very interesting benchmark and huge antipattern code
There's a whole bunch of latencies to measure for this kind of stuff.
First you have dispatch -> run latency.
Then you have 1st dispatch -> 2nd dispatch.
I guess the os sheduling on the sleep wake up dominates
09:01
Then end task -> next task...
@Mysticial I personally find GDB much inferior to VS debugging.
tricky to measure yes
GDB makes the most basic task of viewing what the state of the program is to be much harder than the call stack and hover effects of VS.
@Puppy This was a particularly bad case for me. It took me 5 minutes to confirm that I was deadlocking. But I gdb couldn't load symbols.
I spent almost an hour on that until I realized that gdb doesn't like filenames with spaces.
5
Then I got my stack traces, and found that I was deadlocking in the places that I was expecting it to deadlock.
At that point, I had to write a "watch dog" thread that would occasionally probe the states of the worker threads to tell me if they missed any signals.
But that started crashing. It worked fine on Windows. Crashed consistently on Linux. An hour later, I realized that it doesn't crash on Linux if I compile for AVX2.
Eventually I traced the crashing watchdog thread down to a bug in the data-structure which I use to hold the thread objects.
__builtin_clzll is count leading zeros. I expected it to return 64 for zero. But it actually returns an undefined number when passed zero.
That fucked up the data structure since it uses to compute some internal index.
64 for 0 sounds reasonable.
09:08
So when I try to access thread 0 it would access a bad pointer.
That's what was crashing the watchdog thread.
Going back to the original case, the thread that's dispatching work would set the work pointer on some random address rather than the worker thread.
The worker thread would never see the update and therefore never run the work.
So the thread waiting for the work to finish would hang -> deadlock.
@Puppy On Haswell, __builtin_clzll is implemented with the lzcnt instruction which returns 64 on zero.
guess I would have expected setting the work on some random address to segfault.
user1804599
case error.toString !== Object.prototype.toString: return error.toString();
default: return 'something went wrong';
On pre-Haswell, it's implemented with the bsr (bit scan reverse) which sets a flag on zero rather than returning 64.
IOW, I fucked up.
user1804599
Haskell.
@Puppy Same. Interestingly it wasn't the case...
The inlining that I tinkered with at the beginning does have an effect. If I disable inlining for all the functions in and around the thread pool, it would work correctly.
This is basically UB not just on the language level, but also on the processor level.
 
1 hour later…
10:16
Shampoo is maybe useful. Some sort of soap + scalp action, occasionally, is beneficial. Plenty of people in the west don't use shampoo or use it rarely.

You don't really need toothpaste. It's the brushing part that's good for removing detritus from your teeth.
HN intensifies
@DmitriBudnikov you fool, get your medical advice on doctissimo like the rest of us
Shampoo is overrated.
Doesn't yield any results, I must conclude the quote is made up
lol
try it again in a couple hours maybe
wait what; how do you wash your hair without shampoo - it clearly makes your hair not greasy
10:28
with some sort of soap + scalp action
My hair is naturally dry as fuck :(
@ScarletAmaranth joking aside, there is such a thing a folks that try to limit their use of shampoo
they go by "the no shampoo movement" or some such, or "the no 'poo movement" for short
this is not a joke
"No poo" (or no shampoo) is a collective term for methods of washing hair without commercial shampoo. == Theory == The first synthetic shampoos were introduced in the 1930s, with daily shampooing becoming the norm in the US by the 1970s and 1980s. Proponents of "no poo" practices believe that shampoo removes the natural oils (sebum) produced by the scalp—causing the scalp to produce more oil to compensate. They also believe that regular shampooing causes a "vicious cycle" to develop as it becomes necessary to shampoo regularly to compensate for the excess oils produced by the scalp (which...
that seems a bit pointless to me - but whatever dingles their mingles
how convenient!
how on Earth do you know about this, come to think of it ^^
10:31
@ScarletAmaranth well, everyone's hair a bit different, I actually find that spacing my use of shampoo works best for me, sort of
@ScarletAmaranth I don't remember, but rest assured that the day I heard about all those folks serious about "going no 'poo" I knew I wouldn't forget about it
@ScarletAmaranth No you do too!
@ScarletAmaranth If I don't do it for more than one day, my hair is full of grease.
I used to have longer hair than Fred and had to shampoo it every day - then I cut it and my life is free of 1 hour showers
Sometimes it's already greasy by the end of the first day.
yeah I know the feeling exactly
I used to have to shampoo every fucking day, and it would take ages due to its length :-\
@LucDanton Same here.
10:38
Justin Trudeau is being praised for his wrong explanation of quantum computing.
I have a big problem with dandruff since I was a teenager, I've went to doctors & tried medical shampoos, it was all useless
@R.MartinhoFernandes I've just youtubed it; I heard: "while apples are usually sweet, bananas grow on trees"
>apples are usually sweet
But bananas do grow on trees.
10:43
both statements are invalid
user1804599
Lol, democrats want to suspend association treaty with Israel for violation of human rights.
What's funny about that?
user1804599
Dunno, it's more sad, actually.
Wait, why is that sad?
user1804599
10:47
bananas grow on trees and pineapples are weird af
Does a hash table by definition not contain duplicate keys?
yeah, no dupes, at least in c#
user1804599
@R.MartinhoFernandes Because they are pro association treaty with Ukraine (lol). I think HR is much better in Israel than in Ukraine.
user1804599
@Shoe You can have a hash table with duplicate keys. Buckets could store (key, value) pairs, allowing duplicate keys. In C++ you have std::unordered_multimap and std::unordered_multiset, which are hash tables that allow duplicate keys.
@Shoe orthogonal
10:51
duplicate keys mean two values have the same hash code
no
duplicate keys means duplicate keys
hash table is different from Dictionary<TKey, TValue>?
So if someone tells you to write an implementation of an hash table for simplifying joins in a relational database, would you allow duplicates?
@DmitriBudnikov context
user1804599
@Shoe Yes; joins can result in multiple rows from one table for the same key in the other table.
10:52
ikr
@JohanLarsson Dictionary is indeed a hash map
user1804599
Are you implementing hash joins? ( ͡° ͜ʖ ͡° )
yup
user1804599
Why?
Tutoring
10:54
A perfect hash function for a set S is a hash function that maps distinct elements in S to a set of integers, with no collisions. A perfect hash function has many of the same applications as other hash functions, but with the advantage that no collision resolution has to be implemented. In mathematical terms, it is a total injective function. == Properties and uses == A perfect hash function for a specific set S that can be evaluated in constant time, and with values in a small range, can be found by a randomized algorithm in a number of operations that is proportional to the size of S. Any perfect...
An implementation of an hash table with multiple keys is non trivial :(
user1804599
table = defaultdict(list)
for row in table_a:
    table[key(row)].append(row)
for row in table_b:
    yield (row, table[key(row)])
user1804599
This is how you do it in Python.
It involves writing iterators for your hash table class
As you can't just return a bucket
Like findKey(X) would need to return a range
user1804599
@Shoe Just use HashTable<Key, List<Value>> instead of MultiHashTable<Key, Value> and you're set.
10:55
@Shoe It is trivial
Just store the key together with the value in the bucket elements :w
@Zoidberg Dat pun
user1804599
In C++, use std::unordered_multimap.
nwp
nwp
is there a way to remove the magic from magic statics without an object?
user1804599
What are magic statics?
10:56
Wait
@JohanLarsson There are no dupes, why?
lol the professor didn't specify that he has to write an hash table, but he specified the hash function to be used. I can use the standard library then.
Probably not
nwp
nwp
magic statics came from C++11 I think, it means that static variables are constructed in a thread safe way on first use
@DmitriBudnikov ok I read you wrong then nvm
nwp
nwp
which requires locks and prevents inlining
there are ways to keep a local reference to the magic static which gets around the synchronization and inline blocking
I wonder how to do that with just a function
probably not possible
10:58
@Zoidberg Israel regularly uses torture, holds political prisoners, and has administrative detention; none of this includes what goes on in the occupied territories.
It's much worse there.
user1804599
@Shoe Yeah, you can. Use std::unordered_map<K, std::vector<V>, my_hash_function_t>.
user1804599
That was easy!
ye
Wait, why not unordered_multimap?
user1804599
Do you want to store the key multiple times?
user1804599
Prefer unordered_multimap if the number of keys is small.
11:00
As a value I would probably have to store the entire tuple of the relation that maps to that key for the attribute X
user1804599
The keys may store information additional to the information used to determine equality. Therefore, they have to be stored in the table, even if duplicate.
Hmm
Maybe I should use a set
and consider the hash function based on the attribute of the tuple
and store the entire tuple as "key"
user1804599
@Shoe It's literally this:
user1804599
def hash_join(table_a, key_a, table_b, key_b):
    table = defaultdict(list)
    for row in table_a:
        table[key_a(row)].append(row)
    for row in table_b:
        yield (table[key_b(row)], row)
yup
user1804599
11:02
Translate that to C++ and you're done.
@R.MartinhoFernandes Israel seem to generally be colossal dicks to me. Like, I get that they're under threat, but it's not like Jordan are going to be invading them any time soon, and they're hardly not justifying armed opposition.
user1804599
std::vector<std::pair<TupleA, TupleB>> result;
std::unordered_multimap<decltype(key_a(table_a[0])), TupleA> map;
for (auto&& tuple_a : table_a) {
    map.emplace(key_a(tuple_a), tuple_a);
}
for (auto&& tuple_b : table_b) {
    auto range = map.equal_range(key_b(tuple_b));
    for (auto it = range.first; it != range.second; ++it) {
        result.emplace_back(*it, tuple_b);
    }
}
return result;
user1804599
Something like this.
user1804599
This code also considers multiple matching tuples.
user1804599
(ugh equal_range not returning an object with begin and end member functions)
11:08
@Puppy They have been the invader themselves countless times already.
"Preemptively", they'll tell you.
earlier in their history I might have granted that.
they were under co-ordinated repeated attacks from several nations who basically refused to accept that they should even exist.
but that was a long time ago now
user1804599
If you want it like a coroutine, you can look at PostgresSQL's implementation. ( ͡° ͜ʖ ͡°)
Yay, I managed to change spreadsort so that it can sort things other than integers :3
@Puppy You mean the War of Independence? Because that's pretty much the only conflict they have been on where they were not the invader.
Yom Kippur War?
11:12
Oh, there's a bunch of those where the invaded countries attempt to recover their lost territories.
user1804599
@Morwenn Everything is an integer if you serialize hard enough.
I don't consider them "invaders", but I can see that POV.
expanders
user1804599
Expando object.
kek
11:14
@Zoidberg Er, ok. That will be the user's responsability though.
user1804599
Just do it like JS: have the default comparator compare string representations.
user1804599
> [1, 2, 10].sort()
[ 1, 10, 2 ]
@Zoidberg Much terribleness.
@R.MartinhoFernandes It's my understanding that they hardly tried to stop at their previous borders.
11:17
Er, the attacks were highly ineffective and there were almost no border changes.
well, they made some initial successes
but I thought they did try various commando landings and shit inside Israel proper
I concede I guess
Not stopping at the previous borders doesn't really imply they wanted more, though. You may want to make an incursion further into enemy territory to better secure your position, weaken theirs, or force an agreement. What matters is whether they intended to accept peace at the old borders.
user1804599
11:36
Cool, IndustrialCraft has Tesla coils.
11:54
TIL Tesla also builds coils
Since 1994 climbing of mountains in Bhutan higher than 6,000 metres has been prohibited
Do not press the Bhutan
I got that google foobar game, from doing a bunch of python searches, or searches for pornography, it isn't clear
12:15
I hear this is good place to ask for SEE PLUS PLUS advice
wtb how to move a fucking thing into unordered_map properly
Because I'm running out of places to write std::move
Just insert a node_handle.
@CatPlusPlus MnCVE?
Move-only keys? You're screwed.
No, value
12:19
Ok, should be fine then
Minimal non-Compilable Verifiable Example
Is "bi-weekly" twice a week or fortnightly?
I tried various kinds of emplace and insert and defaulted move ctor and manual move ctor and the goddamn local still holds onto the thing that's supposed to be moved out
map.emplace(key, std::move(value));
@R.MartinhoFernandes 2x a week
12:20
@R.MartinhoFernandes Both
@CatPlusPlus That was a helf-joke: some recent proposals proposes to add the ability to extract nodes from std::map and std::set to reinsert them directly in other map/set instances, but that wouldn't work for std::unordered_map anyway
Well it's a map actually I changed it but that's not really important
Ell
Ell
emplace and try_emplace ought to work, right
try_emplace is an awesome name
you can pass it a std::lit_candle to boost the chances of successful insertion
12:27
what is next, please_try_emplace and later its please_try_emplace_if variant?
Feb 13 at 4:31, by milleniumbug
You know what's vexing? emplace replaces existing key, try_emplace doesn't (C++17), but insert doesn't replace existing key, and insert_or_assign (C++17) does.
Ell
Ell
the first two makes sense
that just about sums up the standardization process of C++
Ell
Ell
actually all of it makes sense
it should have been called insert and try_insert though
12:28
it makes sense except for you don't want to be thinking about it when you're solving a problem pertinent to you
L42
It's terminating because thread object ain't moved and so it's destructed without join
@CatPlusPlus why are you writing C++ anyway?
nwp
nwp
today I learned how to kill magic to gain unnecessary performance points
I'm just gonna new this shit fuuck values
12:33
what software are you writing for which you of all people would use C++ then
A buttmud
Adding defaulted move assignment operator moved the core dump after the frob2
Wow improvement
Ell
Ell
error: C compiler cannot create executables
well :V
food delivery finally arrived
12:36
It doesn't work with unique_ptr either
@Ell Probably creates object files? ;p
It just doesn't fucking move anything
christ
it doesn't move indeed, it casts
Ho ho ho that is significant discovery
Not
nwp
nwp
@CatPlusPlus scott thinks it is
12:38
scott is a phony
I used new without unique_ptr and I'm not even going to bother writing a dtor because who cares la la la
Now it works
Hello modern C++
Well, Valgrind will complain, so I guess I'll write that stupid thing
@CatPlusPlus You fucked it up.
you called get_id() on the thread after it was moved from.
so the other threads weren't inserted because you tried to emplace them all for the same key.
so they weren't moved and hence triggered the problem.
arguably this is a dumb in get_id() which should throw or something in this case.
lol nice one
12:45
Yes probably
Thanks
I suspected this but dismissed this as "nah, that's probably not it"
well
typically you would not have named the thread at all, since it is directly moved into the thread_info constructor immediately.
I forgot C++ compilers are entirely unhelpful
in that case you can't reference it after it's been moved and so this bug is not possible.
std::thread behaves like a hot potato
12:58
Embrace std::joining_thread.
lol that would be even worse

« first day (2010 days earlier)      last day (3164 days later) »