« first day (2055 days earlier)      last day (2895 days later) » 

6:00 PM
The trick is that I can use the last third as a "buffer" to perform an out-of-place merge.
Using std::swap_ranges instead of std::move of course.
 
what is blind mergesort?
 
Mergesort with a buffer.
I don't know how that kind of mergesort, but "blind" sounds cool :D
 
nwp
@fredoverflow with regards to templates it can. I believe some day std::is_same_t<T, U> will be replaced with T == U and other little things that overall make everything much simpler
 
Basically, it's not an inplace mergesort, but the buffer is taken from the original collection, so we don't have to allocate anything.
 
where do you keep the elements of the last third while using it as a buffer?
do you swap back and forth?
 
auto f() -> void
really?
 
It's not even optimized, but by using a bottom-up mergesort instead of a top-down one, it could use O(1) auxiliary space.
@orlp Always, except for main.
 
log(n)
if you do some recursion you have log(n) space
 
@orlp Well, I don't actually recurse. I loop instead.
Anyway, it's party time tonight. See you later :D
It's quick_sort2 in the benchmark. quick_sort is a simple median of 9 quicksort, and you know the other ones.
 
it's not quicksort though :P
@Morwenn regarding that
I never found median of 9 worth it in my benchmarks
 
6:08 PM
@Morwenn Why except for main then
 
@orlp Well, it isn't good, but I wanted a quicksort that worked with forward iterators, and median of three didn't pass the benchmarks because of its worst case x)
@milleniumbug I don't know, hardcore cargo cult I guess. And I like it when main is special :p
I've been here for too long, bye!
 
user1804599
cool Rust has pattern matching conditions
 
auto main(int argc, char ** argv) -> decltype(argc)
 
user1804599
if let Some(x) = foo { ... }
 
user1804599
6:11 PM
only executes the body if the thing matches the pattern
 
I think Swift has this as well.
 
user1804599
Inst::If(c, t, f) => {
    if let Some(Const::Bool(bc)) = consts.get(c) {
        sub.replace_inst(inst_id, Inst::Goto(if bc { t } else { f }));
    }
},
 
user1804599
Constant folding conditional jumps. :)
 
user1804599
Oh cool, I got a borrow error because I'm modifying something that I'm looping through.
 
Hey guys what's up?
 
6:25 PM
@AaronHall The direction your thumb points when you like something.
 
feels a little embarrassed for not knowing that
 
Hm, what else is up...
Apparently, rightfold hasn't discovered a reason to hate Rust yet.
 
nwp
@fredoverflow I thought you learn about mut fairly early
 
rightfold's user profile says, "Your question is bad and you should feel bad." and it makes me feel a little bad. :(
refuses to write any more questions
 
user1804599
Good.
 
user1804599
6:31 PM
Bad questions are bad.
2
 
If only there was a way of knowing it was bad before it got posted...
 
Yeah, but that bad-good not bad-bad.
It's a different bad.
 
nwp
@AaronHall nah, that's impossible, research doesn't exist
 
user1804599
So good.
 
6:33 PM
@AaronHall Feed it to a Turing machine and see if it halts? ;)
 
user1804599
@fredoverflow Rust is great.
 
user1804599
@fredoverflow You can't.
 
nwp
I want to have this
 
@rightfold Why not? Make coffee and check every couple of hours whether it has halted yet...
 
If I can research, I can answer my own question, right? So why ask the question then?
 
6:35 PM
@fredoverflow Yes, but at least at times he's also liked Perl, so take that with appropriate amounts of salt.
 
user1804599
@fredoverflow If it never halts you'll never get an answer.
 
@rightfold Fine with me, we're not talking about me feeding the Turing machine, right? ;)
 
user1804599
Ok constant folding works, what should I implement next?
 
nwp
@rightfold move semantics
 
user1804599
6:37 PM
@nwp no that's not in the scope of this project
 
> Just make the language turing incomplete. Problem solved.
> Go back to Coq, you crazy bastard ;-)
 
Like, this guy didn't do his research, and he got 10k upvotes on his question: stackoverflow.com/questions/927358/…
 
lol
@AaronHall Nobody here is telling you not to ask a question on stackoverflow.com
 
nwp
@rightfold give the AST to the program and let it manipulate it like in lisp so everyone makes their own language
 
It's arbitrary.
 
user1804599
6:39 PM
The "AST" is a control flow graph of sequences of instructions.
 
That's why I only answer questions.
 
@AaronHall What is your motivation for asking a question? Do you want a useful answer, or do you want imaginary Internet points?
 
If I do ask, I'll hold on to it until I have an answer for it.
 
nwp
@AaronHall that is a community wiki and was posted at a time when anything got thousands of upvotes no matter what
impossible to do today
 
user1804599
> Dalai Lama says there are 'too many refugees in Europe'
 
user1804599
6:41 PM
ugh, didn't know he was such a racist
 
@rightfold Oh shame. I thought it read inferior designers
 
user1804599
lol
 
löl
 
user1804599
no it seems like a nice skill to possess
 
> seems
All skills are nice to possess if it makes you happy.
Moar fapping
 
user1804599
6:43 PM
Ah! I know what optimisation to implement.
 
user1804599
Turning !a && !b into !(a || b) and !a || !b into !(a && b).
 
DeMorgan is always nice
 
nwp
@rightfold no operator overloading for you then
 
@fredoverflow both. But seriously, I'm usually good enough of a researcher to find the answer myself before I get a decent answer from someone else. What we need are people who are smart and can ask good questions who are bad at research/google.
 
@Ell in fact, NRVO removes the need for move
 
user1804599
6:45 PM
@nwp There are no operators at all.
 
user1804599
There are and, or and not instructions.
 
@rightfold That in iteslf is a transform, not an optimization
 
user1804599
@sehe It's a transformation that makes the program more efficient, so it is an optimization.
 
sbi
@JerryCoffin Yes, but assuming a comparatively small vector of strings, a comparatively small number of objects to insert, and no move semantics, in practice you should not ignore this.
'evenin'
 
@rightfold how does it make things more efficient?
You mean on your artificial target machine there is a difference?
 
6:47 PM
@AaronHall 100 imaginary Internet points if you recognize my shirt @ 51 minutes in.
 
user1804599
@sehe one fewer instruction
 
lol.
 
sbi
Assuming std::map<int,std::string> int2str_map;...
int2str_map[42]="42";
int2str_map.insert(std::make_pair(42,"41"));
Is the call to insert() supposed to assign "41" to the value at 42?
 
user1804599
LLVM does this too :D
 
user1804599
But this helps more in my target languages, e.g. PHP, which potentially has to do implicit conversions in logical nots, and JS too.
 
6:50 PM
@sbi Maybe to check whether the insert had an effect or not?
 
user1804599
@sbi no, insert does not overwrite
 
sbi
@fredoverflow I wasn't expressing myself as lucidly tonight as I should have. Sorry.
 
user1804599
Unlike in every other library ever.
 
sbi
@rightfold Ah, thanks.
 
@rightfold It doesn't? Interesting.
> Returns a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.
oh right
 
6:52 PM
@sbi no
 
@sbi Oh, I get it now.
 
What I need is an AI to come up with questions and a sockpuppet to ask them (after I review them, naturally.
 
sbi
@fredoverflow I read that, but wasn't sure whether this would forbid assigning the value. (That's not an assertion, after all.)
 
@AaronHall Why not make an AI to review them?
 
@sbi Yup--big-O is one of those theoretical things. In theory, theory and practice are the same, but in practice, they're quite different.
 
nwp
6:53 PM
@AaronHall why sockpuppet? you can just ask and answer your own questions
 
user1804599
@sehe even if there wouldn't be, it would reduce the size of the program
 
nwp
at the same time actually
 
sbi
@JerryCoffin I am writing a non-theoretical container.
 
Yeah, if it's successful, I'll merge accounts.
 
@JerryCoffin It's a pretty practical matter really. It's just not the whole of the practicality.
 
6:54 PM
@rightfold that would just make the optimization not-apply in the first place; because either the conversions amount to side effect OR the repeated not is subject to ordinary CSE optimization
 
@sbi If you need to "insert in the middle" a lot, you may be interested in investigating gap buffers.
 
@rightfold in source code
 
user1804599
@sehe PHP does no CSE
 
o.O
The first point still stands too
 
user1804599
PHP is dynamically typed. Its not operator has to check the kind of value every time.
 
sbi
6:55 PM
@fredoverflow I am writing a flat_map. (In case anyone wonders, the issue got scrapped, which I missed/forgot when I started; but given that I was almost done when I understood this, I am now finishing it in my spare time.)
 
user1804599
Eliminating the not eliminates this check.
 
@sbi flat_map is unordered_map without buckets?
 
user1804599
!a && !b does four such checks. !(a || b) does only three.
 
@rightfold There are architectures were !a && !b is equally fast (andn instruction) or even faster (nandn instruction).
 
user1804599
I'm not targeting those. :)
 
user1804599
6:58 PM
Also, V8 looks at the AST size to determine whether to inline a function. Making the body smaller by eliminating the not is a win.
 
sbi
@QPaysTaxes Mostly to benefit from caching-friendly vector and for when the maximum number of elements is known beforehand (using our static_vector).
@fredoverflow Based on an array/vector of pairs.
 
Maybe we should verify new accounts with a phone number?
 
@sbi classic open hashing vs. closed hashing
How do you handle collisions?
 
sbi
@fredoverflow No hashing.
 
@QPaysTaxes you don't have a phone?
 
7:00 PM
So how do you find the correct index?
 
sbi
@fredoverflow by searching.
 
I have Google Voice and a work phone.
Just about everyone has some kind of access to telephony.
but it seems harder than creating throwaway email accounts.
 
@sbi Ah, so an association list with O(n) retrieval. Why would you want to implement that?
 
sbi
3 mins ago, by sbi
@QPaysTaxes Mostly to benefit from caching-friendly vector and for when the maximum number of elements is known beforehand (using our static_vector).
 
@QPaysTaxes do you think you could have a friend accept a text message with a code for you?
 
7:03 PM
@sbi Okay so no more than, say, 30 elements, right?
 
A friend would be a cooperating human with a phone.
 
sbi
@fredoverflow Why?
 
Because O(n) doesn't scale? :)
 
user1804599
> What element do you think is the coolest and why?
Oh, I think helium because it boils at four degrees absolute.
 
user1804599
Oh this guy is a hero.
 
sbi
@fredoverflow Indeed. But why 30? Why didn't you ask for 90 or 300 or 3287?
@QPaysTaxes What you want is a parser, and std::istream isn't one.
 
0
A: How can I get elements of a struct as a type boost::shared_ptr

seheI might read the question wrong - it's not entirely clear. Responding just to the title "How can I get elements of a struct as a type shared_ptr" you can and should use aliasing-constructors of shared pointer: Observation::Ptr p = std::make_shared<Observation>(); // take shared_ptr to a **membe...

It's not everyday that you come across something that looks like a good usecase for shared_ptr's aliasing constructor
@rightfold That doesn't look cool
@QPaysTaxes You can hire someone to do it
 
2 factor authentication.
 
sbi
@fredoverflow Indeed. But why 30? Why didn't you ask for 90 or 300 or 3287?
 
sbi
7:14 PM
@nwp That looks a bit disgusting.
 
@QPaysTaxes Yeah. If you're poor you'll do your own typing
 
nwp
@sbi he will eat you first
 
she*
 
@sbi I've thought of something similar, but what I thought of was kind of a hybrid. Start with the sorted vector, but when you add things, just add them (unsorted) into a separate chunk (so you always add new items to the end). To do a search, you binary search in the sorted chunk, and linear search the unsorted chunk. When the unsorted chunk gets large enough, you sort it, merge with the main chunk, and start over with a new unsorted chunk.
 
@rightfold Spoken like a true bureaucrat. I'm surprised you don't seem to be fond of Europe.
 
user1804599
7:19 PM
???
 
user1804599
First, I don't see how bureaucracy is related.
 
user1804599
Second, I'm fond of Europe. It's a wonderful continent.
 
Eurasia is great
 
@rightfold Sometime it really does help to think for a while
Steps to bureaucracy:
1. have a goal
2. agree on the goal
3. make rules to help reach the goal; reward behaviour that meets the (artificial) criteria in the rules
4. people optimize processes to meet the criteria
5. people have lost sight of the goal, bureaucracy is rewarding behaviour that doesn't help goal but meets the criteria
 
user1804599
The goal is to make the program more efficient.
 
user1804599
7:30 PM
This does that.
 
user1804599
Compilers are good at micro optimisations.
 
user1804599
But I'm pretty sure you compile with -O0 in release mode.
 
@rightfold No that was the goal. It has been replaced by "make the AST smaller" in that example.
(or perhaps by a stretch, "randomly create more inlining opportunity")
@QPaysTaxes Try better next time :)
 
nwp
I got an answer in right before the question got closed. I'm unsure if I should feel accomplishment or shame.
 
That was your goal. Good game
I like step 8 though it's not related to the analogy at hand
 
7:34 PM
@QPaysTaxes That's the kind of logic that leads to building a Vasa. Congratulations!
 
I'm just ignoring it because the execution is too tedious for such a dense joke
@QPaysTaxes Oh hell yeah. Rightfold's simplified mental model of an optimizing compiler has some ways to become the epitome of bureaucracy.
 
user1804599
Optimize everything.
 
@QPaysTaxes I was bringing it back on topic just to be sure. Going full round on a stretched analogy like that takes some sharp steering.
@QPaysTaxes I'm not optimizing for faster linguistical clicks in QPT's brain
(meta acknowledged, before you drudge it out)
 
@sehe Steps to bureaucracy: CELLULOSE
 
That helps?
 
7:48 PM
@набиячлэвэлиь Somehow bureaucracy makes me think more of nitrocellulose.
 
I did a chemistry paper once on high explosives
 
@Puppy I guess we're about even. I did a high school paper on chemical explosives.
 
@Puppy How can explosives take drugs?
 
7:54 PM
well I swallow water and some pre-prepared industrially manufactured pills
 
user1804599
lol also the comment by OP
 
@StackedCrooked all the proof we needed!
 
A tautology is a tautology.
 
user1804599
 
@JerryCoffin I did an explosive paper high on chemicals
Anyhoops. Another shooting at UCLA.
Another day.
 
@sehe sigh I can't imagine what it's like to fear for your life in your own school.
 
nwp
I want to write some useful software and I'm still stuck on getting cmake/clang libs to work.
maybe I should just go with one of the shitty options that actually work instead of the correct option that I just cannot get to work
and with enough rationalization the shitty option has some merit to it
 
@rightfold I was reading that linked comic about depression
sounded a bit too familiar for my liking
but I got to near the end about the corn and the next track just happened to come on and it's the bit where Pegasus saves Galactica and it was perfectly timed.
 
sbi
8:32 PM
@JerryCoffin This seems like one of those ideas that are easy to do as a human, but have a lot of parameters to fiddle with, all of which are heuristic, and thus are hell to implement for more than one specific case... :)
Anyway, I better go to bed now. G'night!
 
eel.is/c++draft is also pretty good
 
not really
 
nwp
@QPaysTaxes insignificant wording differences usually
 
@QPaysTaxes I wouldn't build an implementation out of it but as a user it's good enough.
 
8:56 PM
plenty your face
 
9:10 PM
@QPaysTaxes It's not a euphemism.
you may have noticed that I'm not really one for subtlety where a punch to the face will do
 
nwp
@QPaysTaxes why would you do such a thing?
have you tried not to?
 
@nwp make. shell script. shittiest options, no surprises
@nwp "there was an attempt"
I like make. Started to appreciate CMake a little since my new job
 
nwp
@sehe I was talking about using a C++ wrapper to a C wrapper to a C++ library, but this is shitty too
 
@nwp If you're having a problem, just check out Wide, I use Clang as a library there all the time.
 
nwp
I don't mind when CMake works, it is just so hard to get it to that point
 
9:22 PM
Oh I misread. Disregard
 
you can ask in #llvm too to get some help
 
nwp
I actually got the source to libclang, which obviously uses the functions I actually want, I was drowned in cmake files including cmake files including tons of more cmake files
 
what platform?
there's only a minimal amount of CMake required on each platform.
 
nwp
debian
 
also what are you doing? building clang? if so then build scripts are in Wide's repo
 
9:27 PM
Wide's repo doesn't contain build scripts for building Clang.
but if memory serves, that's because it's now unnecessary and we just get the library from a package.
 
actually it does
 
nwp
building clang is no issue
 
nwp
including it as a library is
 
sudo apt-get install -y llvm-3.6-dev
sudo apt-get install -y libclang-3.6-dev
should be enough.
ah you built Clang manually in install-deps, okeydokey
 
nwp
9:29 PM
@Puppy yeah, I got that, but none of the libs in there define symbols such as clang::tooling::* or clang::ast_matchers::*
 
there's a clangTooling lib
which I reference in Wide
and I'd be pretty fucking surprised if clangTooling does not define clang::tooling
 
nwp
no clangTooling lib in debian apparently
I'll just go with the wrapper and pretend I did it for the stability across versions
9
 
Sorry. Pixels out of stock
 
nwp
@sehe what an asshole
 
9:52 PM
hmm
I kinda want to fold and zip at the same time
 
user1804599
10:14 PM
I wonder for how high a bounty you could bribe a mod
 
@sehe Peter Watts facebook account?
 
user1804599
Actually I'mma start working on inlining first.
 
user1804599
Because doing that forces me to implement modules
 
user1804599
And loading globals
 
fuck
I hate that VS does not properly rename folders when you rename projects.
or delete them when you delete projects for that matter.
 
10:24 PM
not a huge problem ime
as it is not something you do every day
once per month on average
 
TIL the expression "pushing rope" from the Archer TV series. :)
@sehe lol
 
user1804599
I wish I were a horse
 
@rightfold I'm trying to resist the temptation to mention how many people think of you as a horse's ass, and mostly failing...
 
user1804599
@sehe Fahrenheit
 
@rightfold what would be the first thing you would do?
oh
 
user1804599
10:40 PM
Dunno. Eat grass or something
 
user1804599
Run around
 
user1804599
Is there anything else horses do?
 
user1804599
Poop on cycling lanes
 
they fart when they jump
loud ones, audible from 50 metres
 
user1804599
I bike past a stable twice a day
 
user1804599
10:45 PM
Omw home and to work
 
gf has two horses
used to have four
 
user1804599
What happened with the other two? Did she slaughter them?
 
@JohanLarsson gneiss
 
@rightfold one is dead, was old, 23 years I think
One is a police horse now, they gave it away
 
user1804599
@JohanLarsson cool
 
10:52 PM
@JohanLarsson neat
 
@rightfold stop at the stable tomorrow and talk to them
maybe they'll let you ride?
 
> >heloł horses I am rigidfold and I rili laik modans
 
user1804599
lol no
 
don't mention the modans
 
user1804599
social skills of a sidewalk
 
10:54 PM
don't worry about that, stop and say hi
no harm in that
 
user1804599
last week there was a whole line of coaches with horses in my street
 
user1804599
like 20 of them
 
user1804599
In Dutch we have a saying "de koetsier poetst de postkoets"
 
user1804599
people consistently fail to pronounce it
 

« first day (2055 days earlier)      last day (2895 days later) »