« first day (836 days earlier)      last day (4111 days later) » 

1:00 PM
Obviously.
 
@jalf How can you think about it and not tear hear from your head
It's soo stuuuupid
 
"tear hear"
 
It's late okay
I'm up for like 14 hours already
 
user784668
What reason for closing would the SO engine show if one person voted for exact duplicate, one for off topic, one for not constructive, one for not a real question and one for too localized?
 
It's either random or last one, I never figured it out
 
1:02 PM
yeah, I think it's last
not sure though
 
We did it before.
 
Sounds like something we'd do
 
definitely happened before
 
I don't remember the result
We should do it again
 
okey. Let's just get a random one from
 
user784668
1:06 PM
0
Q: New idea for my simple calculator without switch-case

xersiI'm trying to implement the first calculator. My old code (switch-case) : enum arithmetic_type{ add = 0, subtract = 1, multiply = 2, divide = 3 }; inline void calculate(double &var, double value, arithmetic_type type){ switch(type) { case add : var += value;...

 
user784668
I'd tag as but somebody'd revert it.
 
[tag:~performance~]
 
user784668
@CatPlusPlus Oh right, it's already there.
 
user784668
Also this question is not a good candidate. Two "too localized" votes.
 
user142019
1:08 PM
My printer is terrible.
 
user142019
Wait, all printers are terrible.
 
user784668
@Zoidberg You printer is bad and you should feel bad.
 
user142019
Why the fuck should I feel bad because of my printer being bad?
 
user784668
@Zoidberg You bought crap.
 
user142019
No.
 
user142019
1:09 PM
My father bought crap.
 
Oh hey I filled out The Form
 
user142019
A Canon. ;_;
 
@CatPlusPlus Tax Form?
 
You should too
It's like a direct line to tell those idiots that they're idiots
 
user784668
@CatPlusPlus What Teh From?
 
user142019
1:09 PM
Canons are for shooting things. Not for printing.
 
user784668
@Zoidberg Nope, cannons are for shooting.
 
Sadly it's not a strip club
 
user142019
Canons are for shooting too.
 
user142019
They shoot pictures.
 
1:10 PM
@Fanael canons are for shooting photos
 
Waste of perfectly good name
 
@CatPlusPlus Why did you write in it?
 
> Posting a lot of PRs without opt-in was the stupidiest idea on earth. GTFO.
 
Because I really, really, really, really, really wanted to insult them
 
"How can anyone be so fucking stupid?"
@Zoidberg No, they should not.
 
user142019
1:11 PM
@CatPlusPlus funny how WHITESPACE DESTROYS THE PLANET, while they clearly have a black background on their website.
 
user142019
@R.MartinhoFernandes BRAINFRAT
 
user142019
lol my test starts in an hour or so
 
user142019
I'll never make that. :P
 
But spaces use jiggawatts of energy
 
Xeo
@Zoidberg Why do you care, again?
 
1:13 PM
Why do I have a feeling that this guy they link to is the one who actually came up with this shit
No, really, I don't know enough adjectives to properly express how stupid this whole thing is
 
@CatPlusPlus What did you write?
 
hmm.
now I recall why I stopped playing BF3
because my CPU melts
 
lol, you spent all that time to download it, and now cannot play it?
 
@R.MartinhoFernandes That it's extremely stupid and they should stop wasting people's time. Tame, I know
 
well, I can play it
 
1:18 PM
@DeadMG Because it sucks?
 
just not for too long
 
You should play Chivalry instead of BF3
Giant Axe > Gun
 
user784668
@BartekBanachewicz You mistyped <.
 
@BartekBanachewicz I hope it comes with a 12.7 Gb download
 
1:21 PM
bf3 ftw
 
user784668
@sehe ~1.5 GB is not that bad.
 
@R.MartinhoFernandes Nah, my CPU is mounted wrongly, I think, but my brother built this machine, not me.
I should get around to remounting it some day
 
user784668
@DeadMG mount -o remount /proc/acpi/processor
2
 
@Fanael Oh well. It doesn't qualify then
 
@Fanael you clearly didn't play chivalry
 
user784668
1:23 PM
@sehe NB: I don't know how much that game weighs. I just made fun of your typo.
 
around 5GB IIRC
 
@BartekBanachewicz And you don't know what "chivalry" means!
 
@R.MartinhoFernandes I do. I just pretend I'm 8yo
 
@Fanael Ah that way. Anyways, nobody knows the weight of games
 
@BartekBanachewicz What does that mean in practice?
 
1:30 PM
@FredOverflow if I nest something (a scope), I use tabs. If I align parameters in separate lines, variables in arrays, etc, I use spaces.
 
makes sense
 
user784668
@FredOverflow That his code looks crap.
 
@Fanael int* p or int *p? ;)
 
user784668
@FredOverflow std::reference_wrapper<int> x
 
@Fanael It does look perfectly like code with only spaces, so that's just space-fanatic bullshit
 
1:32 PM
@Fanael Is that what std::ref returns?
 
user784668
@FredOverflow Yes.
 
Well, tabs should compile 4 to 8 times faster than spaces, shouldn't they? ;)
 
user784668
@BartekBanachewicz Change tabstop.
 
@Fanael If by tabstop you mean tab size, it will still look good.
 
user784668
@FredOverflow Not really. The lexer in Clang has some optimizations for handling runs of whitespace.
 
1:35 PM
I understand the "we don't live in perfect world, so just keep all as spaces for simplicity", but "tabs are bad, because bad" is just plain stupidity
 
@Fanael Interesting. I was just kidding, by the way, because long compilation times don't stem from lexing, usually ;) But still, interesting.
How do they call this optimization? "The most lexing parse"? ;)
2
 
use tab stops it will make compilation faster, oh god lol
 
user784668
@FredOverflow for loop.
 
@Chad Also, short identifier names speed up compilation ;)
 
@Chad your builds don't take 20 minutes, do they?
 
1:37 PM
@Bartek we changed over to SSD drives to speed up compilation times and also incredibuild
Espcieally when we compile the chrome source
 
@Chad these two are great indeed. Kudos for that.
People often buy more powerful CPUs, and that just doesn't cut it.
 
I think you can buy SSD's now 512gig for $160 to $200
 
Xeo
128gig SSD is 90€ here, I think.
 
I have 128GB now, but I think I'll buy another soon.
 
256 for $160 is the norm really fast reads, a little bit slower writes though you're going to be reading more than writing.
 
1:38 PM
I'd like a Self-Encrypting Drive though.
 
Xeo
I don't even get my 64GB one full, what do you need 256 for?!
 
user784668
SSDs are slow compared to RAM, though.
 
trueencrypt we use
Anything physical is slow compared to ram lol
 
@BartekBanachewicz How much of a performance hit would that incur?
 
Xeo
@Fanael Aye, RAM disk still beats the shit out of SSDs, I think.
 
1:39 PM
SEDs are something totally diffent to TrueCrypt and other software solutions
 
user784668
@Chad RAM is quite physical, too.
 
@FredOverflow 0. + epsilon
 
@Xeo for size/cost comparision Ramdrives are really bad idea.
 
Xeo
@Chad Well, sure, but for performance...
 
@BartekBanachewicz So... some number? :)
 
user784668
1:39 PM
@Xeo Also OS caches. I don't get why people are so excited about making cold builds faster, if most of the time the data is already in the cache.
 
@BartekBanachewicz Disk input/output should not be a compilation bottleneck.
 
@Fanael physical in the sense of a spinning drive at 57000 rpm and a head that has to move accross a plater. Instead of electronics going through silicon transitors.
 
@FredOverflow actually, the only number you'll get is really 0
 
Anyway, encryption is not for me. I'd be much too scared to forget my password and lose all my data :)
 
@R.MartinhoFernandes should be != in most cases is and nobody knows why
 
Xeo
1:40 PM
@R.MartinhoFernandes What. Disk reads were the top compilation slowdown last I heard.
 
user784668
@Chad SSDs have no spinning parts.
 
@R.MartinhoFernandes did you profile? :)
 
@BartekBanachewicz When I compile the 6 megabytes of code in ogonek it takes way longer than reading, or writing, or doing whatever you want on the disk fifteen times in a row to those 6 megabytes.
 
@Fanael Except for the quarks ;)
 
user784668
1:42 PM
You have a singleton. Therein lies your problem. — Fanael 7 secs ago
 
@R.MartinhoFernandes That doesn't mean that if you chagned to a faster drive, compilation times wouldn't drop significantly.
Think batch processing (in your 2nd case)
 
user784668
@BartekBanachewicz Think C++ compiler running in RAM. Yeah, sure.
 
@Xeo depends a lot on the code
 
@BartekBanachewicz Yes, it does. There isn't much disk I/O to cut out. Even if I cut it out entirely, I wouldn't notice it.
 
user784668
I can build GCC in 20 minutes on HDD, how much time would it take on a SSD?
 
user784668
1:44 PM
19 minutes?
 
For C++ code where each compilation unit needs to touch 2000 headers, I/O (seek time especially can be significant. And of course, for crazy template code, I/O is pretty irrelevant
 
@Fanael why don't you test it?
 
user784668
@jalf OS caches ffs.
 
user784668
@BartekBanachewicz I don't have an SSD?
 
@Fanael then buy one, dinosaur
 
1:45 PM
@Fanael benchmark it then, if you think that fixes it :)
(hint: it doesn't)
 
@jalf actually the compiler keep recompiling the template code but uses a sepcial flag for the linker to tell it to ignore the duplicated code.
 
Anyway, if you build a lot, even 5% is a lot of improvement
 
@Fanael lol, didn't know the Multiton pattern was real:
In software engineering, the multiton pattern is a design pattern similar to the singleton, which allows only one instance of a class to be created. The multiton pattern expands on the singleton concept to manage a map of named instances as key-value pairs. Rather than have a single instance per application (e.g. the object in the Java programming language) the multiton pattern instead ensures a single instance per key. Most people and textbooks consider this a singleton pattern. For example, multiton does not explicitly appear in the highly regarded object-oriented programming text bo...
 
std::vector<int> may be recompiled multiple times but the flag will instruct the linker only to link to one source of it.
 
user784668
@FredOverflow A singleton that can be created twice?
 
1:46 PM
@Chad um, yes? How does that relate to what I said?
 
@BartekBanachewicz It isn't that important to accumulate a gain of 5 minutes after 100 builds.
 
user784668
@Chad COMDATs are built-in into the linker, no special flags for them. In relatively sane linkers, at least.
 
@Fanael don't be silly, that'd be a Duoton
 
@Fanael No. Like Singleton, but with n != 1.
 
@jalf you said that I/O is irrelevant when it is a major issue
 
1:46 PM
@Chad He didn't.
 
@Chad How does I/O relate to template code being recompiled?
 
user784668
@Chad I said it is.
 
Multiple compilation units compiling the same template instantiation does not cause any additional I/O
 
And whatever, I already bought RAM, I shouldn't need to buy a disk to less benefit than that.
 
Multiton aka the Shitton
 
1:47 PM
And of course, for crazy template code, I/O is pretty irrelevant. That is wrong I/O is still important, and most of the majority of the time the linker is searching object files.
 
@Chad you mean the linker wouldn't have to read the object files if you didn't instantiate templates?
 
user784668
@Chad How is I/O relevant for an interpreter of a Turing-complete language if the source is already in the RAM?
 
@Chad how do template instantiations force the linker to do more I/O?
 
@Jalf no saying that I/O is a big bottle neck when doing large compilation and linking. So if you remove I/O eg.. SSD then you can drastically reduce your compilation time. Also use better linkers
 
hey robot
 
user784668
1:49 PM
@Chad SSDs don't remove I/O.
 
@Chad what.
 
turns out that my range designs are one step ahead of the Committee's
 
public class Zeroton
{
    private Zeroton()
    {
    }

    public void method()
    {
        System.out.println("A miracle!");
    }
}
 
user784668
@BartekBanachewicz Gonna benchmark a GCC build in a tmpfs.
 
^ for when a Singleton is not secure enough.
 
1:50 PM
@Fanael Don't forget to use gold to preempt the haters.
 
user784668
@FredOverflow private Nullton() { new Nullton(); }
 
Wat?
 
user784668
@LucDanton It's the default in Arch anyway, it seems.
 
Let's try again: I pointed out that in template-heavy code, I/O might not be a significant contribution to total compilation time, because, you know, actually compiling the templates takes much, much longer. You argue that this is incorrect. Now, this can only be incorrect if adding more template instantiations also causes more I/O. Therefore I ask you "what is this extra I/O?" And you have not yet been able to point it out to me. Therefore I conclude that you are wrong
 
@jalf Isn't IO waaayyyyy slower than anything else? :)
 
1:51 PM
Compilers do stupid things sometimes. And the answer to "what is this extra I/O?" might be reading the same file over and over.
 
@Chad If you reduce the time spent on I/O then yes, you reduce the time spent on the total compilation, yes. But that kind of completely missed my point. You need to show that even in template-heavy code, I/O actually accounts for a nontrivial fraction of the total compilation time
 
user784668
@jalf 1/infinity seems pretty nontrivial to me.
 
@Fanael What.
@BartekBanachewicz So, FUD?
 
user784668
@R.MartinhoFernandes That's the fraction of total compilation time spent on I/O when compiling heavy template magic.
 
Compilers are not magical. They are, but they aren't.
@Fanael But it's trivial.
 
1:54 PM
An infinitely small fraction is nontrivial? That poses an interesting question then. If that is not trivial, then what could possibly be?
@R.MartinhoFernandes and therein lies the magic
 
@Fanael 1/infinity is 0. and not close to zero, it's 0
 
@jalf Your mom?
 
Your mom is trivially fat.
 
<facepalm>
 
user784668
@BartekBanachewicz Yes, I know.
 
1:55 PM
@BartekBanachewicz 0 is pretty close to zero as well...
 
@jalf infinitely close :P brb, coffee
 
user784668
 
user784668
0
Q: Removing branches via bitwise select

TravisGI was told that the branches in the code int value = //some number; if(value > some_other_value) value *= 23; else value -= 5; can be eliminated via bitwise masking (in order to enable SIMD optimization for the code): const int Mask = (some_other_value-value)>>31; value = ...

 
user784668
Well, this optimization is invalid if the subtraction underflows.
 
hey guys, I am trying to implement a singleton class in multithreaded environment
22
 
2:01 PM
@Gopikanna get out
 
Tell me it's a joke.
 
user784668
@Gopikanna Don't.
 
user784668
@R.MartinhoFernandes It's a joke.
 
Why do people like to inflict this upon themselves?
 
I have already googled and found various methods to do it. Only the full locked approach seems to be the safest
 
2:01 PM
It's also silly.
 
user784668
@Gopikanna You don't use singletons, you don't have problems.
 
or is there any other efficient and safe approach?
 
user784668
@Gopikanna Yes, it's don't use singletons.
 
@Gopikanna yeah, don't use singletons.
 
Don't mix shared state with multithreading.
 
2:03 PM
@Gopikanna Poor soul.
 
Xeo
@Gopikanna Make it a Multiton, one instance per thread-ID!
 
hmm, what about ?
 
room topic changed to Lounge<C++>: We have so many tags! [c++] [c++11] [c++-faq] [get-out] [no-questions] [no-singletons]
 
user784668
@BartekBanachewicz Five tags max? Oh wait, no.
 
@Fanael apparently not :)
 
2:05 PM
Yup - just create the soddin' things at app init and be done with.
 
:) ok what is the replacement of singleton
 
Good design?
 
@Xeo , No I need only one instance of the class for the process
 
That's like asking: "What's the replacement for the hammer?".
 
@Gopikanna need?
Then just make one instance. The language already has support for making one instance.
But sharing that across the threads will still cost you.
 
2:07 PM
@StackedCrooked nice example
 
don't say global
 
@Gopikanna Wrong. "What's the correct method to do X"
@Gopikanna don't say singleton, either.
 
@Gopikanna Why not?
 
user784668
@Gopikanna Globals aren't that bad.
 
user784668
2:09 PM
Can I have a question?
 
@Fanael :)
also, you just asked one
 
user784668
@BartekBanachewicz The point.
 
If you think a singleton is better than a global, you are wrong. It brings along all the same characteristics.
 
@Fanael Sure - why does the beer always need changing just as I enter the club?
 
user784668
@R.MartinhoFernandes And moar suckiness.
 
2:10 PM
(And before you say it, globals can be instantiated lazily too)
 
Globals can be instantiated lazily too. ...Dammit!
 
user784668
@R.MartinhoFernandes Can they? You mean function-"local" st…c?
 
@MartinJames Because you always follow the beer truck to the club.
 
@Fanael No, globals. Just use optional or pointers.
 
@Fanael that's pretty much what singleton is :)
 
2:12 PM
a proper "singleton" is a helper class like this - singleton<Foo>::instance()
 
@Fanael But yes, function statics are easier.
 
user784668
@Abyx A proper singleton is no singleton.
 
but some animals say that it's not "singleton"
 
@Abyx singleton is a pattern
 
@BartekBanachewicz nope.
 
2:13 PM
@Abyx -.^
 
user784668
@R.MartinhoFernandes But then it's pointer/optional what's global, not the object itself.
 
@Fanael Technicalities.
 
user784668
@R.MartinhoFernandes Well, the room name says C++.
 
@Abyx lazy<Foo> a; lazy<Foo> b; is more flexible and way less verbose.
 
user784668
@R.MartinhoFernandes I want dat lazy, for I'm too, uhm, lazy, to implement it myself.
 
2:15 PM
@BartekBanachewicz *antipattern.
 
@JerryCoffin true.
 
user784668
Jan 15 at 20:33, by Cat Plus Plus
> What are some examples of anti-patterns?
 
user784668
Jan 15 at 20:33, by Cat Plus Plus
Patterns
 
@R.MartinhoFernandes but it's better to have methods, like const_instance(), mutable_instance()
 
Well, even Cat can say something that makes sense time to time.
5
@Abyx there's no such thing as method in C++, FYI
 
user784668
2:17 PM
@Abyx a.const_instance().wat("hunter2")
 
hm... however one can use const lazy<T> t;
 
@BartekBanachewicz No one cares if you don't understand what everyone else does.
 
@Fanael who told you my password?
 
user784668
@Abyx Also that.
 
meh.. who gives a fuck about singletons anyway
 
user784668
2:17 PM
@SamDeHaan I just copied your *******.
 
@R.MartinhoFernandes I'm just being pointlessly picky.
 
@StackedCrooked , nice example, but I am not using c11
 
@Gopikanna That's pretty obvious; there are no classes in C. We assume you are using C++ 11
 
@BartekBanachewicz there are classes in C.
 
user784668
@Abyx wait wat
 
2:19 PM
@Abyx which have no language support whatsoever. Nice definition of "there are"
 
there is no class keyword. but you can do classes if you want
 
No.
you can use functions to operate on structures. You can't construct a class instance or even the class itself.
 
You guys are starting a stupid discussion.
 
@StackedCrooked std::shared_ptr<std::promise<T>> is like two indirections :|
 
That's pretty much the definition of not having classes.
 
user784668
2:21 PM
@Abyx More like lazy<const T>.
 
Well, it's one indirection too many anyway.
 
@BartekBanachewicz ,sorry I meant I am not using c++11
 
@LucDanton Feel free to improve it.
 
@Gopikanna okey, so first change that. We're in 2013, you know.
 
:) I don't have control on that decision
 
2:22 PM
@Abyx Only for a debased, low-class definition of "class".
 
@StackedCrooked I just did: get rid of the std::shared_ptr.
 
@Gopikanna because?
@JerryCoffin your classes have no class.
 
@BartekBanachewicz because of management hierarchy
 
@BartekBanachewicz And there isn't one compiler with proper non-experimental support.
 
@R.MartinhoFernandes not that there's a compiler with proper C++03 support
 
2:24 PM
@StackedCrooked is there some kind of tracer thingy that outputs when it is constructed in Coliru?
 
Oi, there's a lounge MineCraft server? Maybe i should start playing again.
 
@R.MartinhoFernandes Not sure what you mean.
 
@BartekBanachewicz There is. export was never relevant. (There is a reason I used "proper" and not "fully-conformant")
@StackedCrooked Maybe it was the duck that had that, then.
Some class you use as template parameter and it counts instantiations.
 
user784668
some_unique_ptr.reset(new Foo()) safe enough?
 
@LucDanton Here, I improved it! You may ignore the segmentation fault :P
 
2:26 PM
@Fanael Yes.
@StackedCrooked packaged_task.
 
@BartekBanachewicz Even if you include export, Comeau did that quite nicely too.
 
@R.MartinhoFernandes Won't work.
 
proper != full. You got me there indeed.
 
@StackedCrooked Why not?
"I have a function that will put stuff in a promise and return something through a future" => that's a packaged_task.
 
2:28 PM
@R.MartinhoFernandes The task signatures need to be erased when stored on the queue.
 
@StackedCrooked So?
@StackedCrooked It's packaged_task<void()>.
 
I don't see a way to do it. Show me working code as evidence that I'm wrong.
 
You want a coke with that?
 
packaged_task<void()> yeah, but that give no advantage over the current way.
@LucDanton I'm not asking for much.
@LucDanton Btw, I also won't work without the shared_ptr.
Unless you find UB acceptable.
 
@StackedCrooked Are you being daft on purpose?
PEOPLE Y U NO PACKAGED_TASK MORE OFTEN.
2
 
Xeo
2:31 PM
Because they don't understand it? :)
 
@R.MartinhoFernandes You just keep saying to use packaged_task but I've tried doing it a couple of times and every time I have to return to the shared promise solution.
 
@Xeo But it's probably the most simple thing in the threading library :/
 
@Xeo That doesn't explain the attitude. "It won't work" is not the same as "I can't get it to work."
 
@StackedCrooked Lemme look at the shared promise solution to see what this is about (I only see the silly UB thing).
 
I mean shared_ptr<promise>
@R.MartinhoFernandes Here it is.
 
2:34 PM
Ok, now tell me what it is that makes packaged_task not cut it.
 
packaged_task requires the original signature, but I can't store it like that on a queue
if the queue should be able to contain tasks with have different signatures.
So I need a wrapper task around the original task which erases the signature to void(). And I also need a shared promise to transport the return value from the inner task to the outside.
 
You don't share the promise with anything. The task owns it.
 
Xeo
@StackedCrooked packaged_task has a get_future function, if that's your concern.
Btw, why do you bind a nullary lambda?
 
Do TBB queues support moves?
 
@Xeo Because I need a common signature type for the queue<std::function<void()>>
 
Xeo
2:41 PM
@StackedCrooked Eh... so? You lambda is already void().
 
QuitException? WTF?
 
Xeo
Binding a nullary function makes no sense.
 
why not just a bool mStop?
 
@Abyx It's an adhortative. "Quit, Exception!"
@Abyx Because OO
 
@sehe o_O ?
 
2:42 PM
@Abyx Or a promise<void>/future<void> pair!
 
@Xeo Doing it like that makes my code work, so for it makes sense :)
 
Russians
 
@TonyTheLion it's not in Russian
 
that's what Reddit said
lol
 
Xeo
2:43 PM
 
@sehe how are exceptions connected to OO?
 
@Xeo Did you change something?
 
Xeo
@StackedCrooked I removed the senseless bind call.
In mQueue.push(std::bind(...));
 
@BartekBanachewicz ... ask java
 
Xeo
2:45 PM
@TonyTheLion Heh
 
@sehe fuck java. I see no reason for exceptions to not work in imperative languages
 
it's supposed to be a book
 
@Xeo Ah, I misunderstood. I thought you meant storing it as a nullary type made no sense.
 
@BartekBanachewicz confusing asking with fucking is a liability in most cultures
 
Xeo
@StackedCrooked Well, yeah, that's something else.
 
2:46 PM
@sehe Can I ask java to go fuck itself?
 
@BartekBanachewicz Ask java
 
I hate you. :)
Ask Ubuntu.
 
@TonyTheLion really? I'd have sworn this was a mock "mourning card" (complete with the glossy wrap you can buy these in)
@BartekBanachewicz That was easy
 
@sehe I just resisted an urge to make a joke about your female parent.
 
Assuming I have one
@TonyTheLion Oh hey. Look closely: it is a card rack as well. So I'm right
 
Xeo
2:54 PM
I want move-captures. :( /cc @R.MartinhoFernandes
 
@StackedCrooked Ok then. Maybe packaged_task isn't too good for this. A shared_ptr<promise> is still silly, though. The point is that you are not sharing it with anything. The task owns it, so make the task own it.
 
Xeo
@R.MartinhoFernandes If TBB queues supported moving, packaged_task would be fine I think. And obviously if we had move captures.
Atleast I hit the problem of the bind functor being copied into the queue.
And that one is non-copyable thanks to packaged_task being non-copyable aswell (I think?).
 

« first day (836 days earlier)      last day (4111 days later) »