« first day (1174 days earlier)      last day (3999 days later) » 

14:00
@sehe boost magic?
@Abyx Whoah, whoah. At least pretend to have read his benchmarks first.
@melak47 yup
@BartoszKP Er... there won't always be some difference.
@BartoszKP Please do not tell me what there is "point" in discussing. I have a fucking right to discuss whatever the fuck I want. DEAL WITH IT
if i set a static array, the compiler done the job in 0 seconds and uses about 0 ram.
14:00
@sehe I'd like to see it when it works :)
@melak47 me too
not sure why?
there's a point to discussing things on the internet?
@BartoszKP You're also wrong, there is not "always" some difference. That was kind of the point I was trying to make
14:01
@jalf Why so angry? : ) Sure you have a right discuss whatever the fuck I want - I have the right to fucking comment about it being senseless discussion :)
@Luka did you compute something that you don't use?
oh, i got why: the optimization removes the unused lines
@Collin See that's the faux safety net again
Let's act all philosophical/cynical and - voilà - nothing has value anymore.
No one can hurt you now
@DeadMG I'm not sure I see what you mean
@BartoszKP Because you are derailing what was an interesting, meaningful and sane discussion before
14:02
It must have been really depressing to be the philosopher to figure that out
@jalf @DeadMG and there we get to the point, what do you mean by "difference exists". because surely you don't want to tell me, that for each execution, or each averaged result, the results will be exactly the same in nanoseconds precision :)
Ell
Ell
Has anyone here used xcb before?
@Jefffrey What I mean is, you're saying "Let's store this value (but we'll really treat it like a string)". This is obviously wasteful compared to just storing a string.
@BartoszKP What I want to tell you that the exact same code is, or can be, generated
Exact... same... instructions
@BartoszKP But it's a bit painful when you actually propell the discussion into meaninglessless with warp speed, intoxicating any meta discussion as well :/
3
14:03
@BartoszKP Well, it might be. But more importantly, whilst you're right that those factors have to be controlled for, they can be controlled for.
you can have the compiler generate the same output code for more than one function, guaranteeing that there is no performance difference between the two.
proved: static c++ array is a bit slower than c array
@jalf I was referring to your "Java is slow" comment, not C/C++ diffference
show us your "proof".
Now, before you barge into discussions in the future and say "this is not relevant to discuss", perhaps you could try to make sure you understand the issue being discussed?
@Luka show everything, including disassembly
14:04
Oh, that makes your derailing even more relevant, doesn't it?
"You guys shouldn't discuss whether there is a cost to C++'s abstractions because Java is slower"
I am facing some issues, vs crashes with too big static arrays...
First plonk of the new year
4
@DeadMG not sure about that, struct x { int y; } is just 4 bytes (theoretically), while "1976526896" of an std::string is more
@DeadMG post the code, please :)
@Luka what does size have to do with things? Are you benchmarking malloc vs. the linux loader?
14:05
@Jefffrey Pathetic micro-optimization. Some types might have more compressed representation as a string.
Here is the code: codepad.org/nuX4gGrr
@sehe Yeah, exactly. I'd rather discuss optimization, than have a meta discussion about whether the discussion is relevant, and whether performance is relevant
@sehe but this is important, whether talking about some embedded devices, a GUI application, a real-time system or a HTTP server, or lot of others. What's worth 10 ms difference for a static GUI application? While it's important in real-time systems. That's why comparing language performance in general is senseless
@DeadMG might is the key there
@Jefffrey Your example is also a might.
(also, did I mention "micro"?).
14:06
hm... thinking of plonked people maybe it's a good idea to proclaim amnesty and unplonk them
of course, I was contesting the "This is obviously wasteful compared to just storing a string."
oh
I meant semantically.
rather than performance.
storing a variant is clearly the semantically clean thing to do because that's what's actually permitted in JSON.
yeah, a boost::variant might work better
@jalf My point was - there are many important and common applications where anyone won't ever notice any difference between Java C++ or other languages, I wasn't talking about "my life" as you implied. That's why "performance" in general is too broad term for such comparisons
@Luka clock? srsly?
14:07
maybe you are right
8 mins ago, by Abyx
@Luka your benchmarks are inaccurate
@Luka Dayum, that's a terrible benchmark.
@BartoszKP just wait. If you can only question the motives, just wait and skeptically watch what transpires. Then, when you see a result getting used to argue invalid conclusions, bitch-slap the perp? Anyways, I'm outta here. Time for work
@DeadMG life is hard
in the end there are only a few "data types" allowed in JSON
14:08
@Luka The compiler can optimize away the whole thing except the text output.
and, indeed, must do so in order for the function to execute at all because the size you set is too large for the stack...
to sum up: I never managed to get those arrays work, i don't know why, but wait for the vector benchmark
@sehe the void conclusion was "Java is slow" :) have a nice day!
@Luka you're not really using the right approach here mate
@BartoszKP ...... Yes. And my point was that whether or not you'd notice any particular performance difference has absolutely not a the tiniest fuck to do with what we were actually discussing, and if you have no interest in participating in the discussion we were actually having, then I don't see why you had to chime in.
@BartoszKP All my apps fall into that category. They are all network-bound or UI-bound. I don't care about CPU efficiency/performance much at all.
14:10
@harold please tell me: why use c++ arrays vs c arrays?
@Luka If it's anything like this, I won't wait for the vector benchmark. You clearly don't know the very very basics of producing useful benchmark data.
@DeadMG yes, I don't
@BartoszKP Oh really. We should have separate rooms for heated debates. This was totally non-obvious
@Luka because 1) why not? and 2) they're better
See, simple
14:11
@Luka why does it segfault?
@Jefffrey no idea also no idea what segfault is
"Java is slow" was not a conclusion. It was a simple tautological statement. "Java being slow proves nothing other than that Java is slow"
@Jefffrey Because your pathetic litte machine has too small stacks
@sehe you mean coliru?
14:12
@jalf well, I "had to chime in" because of your senseless statement that "Java is slow" :) But I'm terribly sorry if I upset you so much - feel free to continue whatever discussion you were having - you're not obliged to discuss with me :)
;)
> C array took: 0
C++ array took: 0
case closed
@jalf go back and read what "tautology" means ;0
so basically
don't draw any conclusions based on your own benchmarks because they're worthless.
Creating meaningful benchmarks is hard. :)
c++ vector took: 0.761, c dynamic array took: 0.596
14:14
the compiler is trying to cheat as much as it possibly can
@DeadMG no, do, by all means. but present what you mean exactly. I have no doubt that many particular examples exist that show that in this case Java code what really significantly slower.
@Luka show the code? :)
@Luka it is useful to say, average of how many runs, and what was the standard deviation. One result is statistically meaningless
also this needs about 3-4 GB ram
14:16
Hello Scott!
Hi Scott
so, what can you say now?
Hello tony
Hello Jefffrey
> C dynamic array took: 0.582
> C++ vector took: 0.291
14:17
@Luka don't use clock() dammit. it's inaccurate. use std::chrono or the rdtsc instruction
Hello scott
not sure where you runned this
@Luka I made one tiny change to your code
@Abyx i know, but I was a bit bored
@jalf like removed all the items from the vector?
14:17
@ScottW Hey How are you? Happy New Year baby <3
@Jefffrey of course
@Jefffrey Hi
@ScottW Danke
memory allocation counts as time
No, I made sure your timing only tested the actual iteration over the vector, without the creation. Because the vector initializes every element to 0, malloc doesn't.
@Luka Sure
but it's relevant where the time is being spent
@jalf yes, that's why is slower
14:18
@Luka use rdtscp and make the arrays smaller, do a million passes instead of making it a million times as long (if the RAM bandwidth dominates, you're measuring nothing)
run that a at least a thousand times and take note of the variance, average, minimum..
One sec then :)
@Luka Er, it's not slower, you have to initialize the memory before it's safe to use it.
> C dynamic array took: 0.562
> C++ vector took: 0.463
for example, you write the vector twice in your loop, you can construct the vector with a pre-set value or a range...
14:19
I get: c: 0.598, c++: 0.77
jesus, if you hate me, read what @harold said
This one is absolutely fair, apples to apples
you're terrible at benchmarking :|
Both versions allocate memory, and write to it once
Setting every element to 100
oh yeah
14:20
@BartoszKP go on, tell me how I'm bad at my job
and I might mention that you didn't check malloc's result for 0.
so when I tried to run this on 32bit it failed.
whereas vector does not have that weakness.
@jalf apples to apples, or maybe apples + apple& accidentally OS decided to swap some memory pages or sth ;0
@harold lol, you misunderstood - I concur to your comment
@Luka I think it's interesting to note that std::vector is actually significantly faster now. :)
@BartoszKP oh alright then
posted on January 02, 2014

Internal validity checking might be able to reveal bugs that neither black- nor white-box testing would be likely to encounter.

14:21
you guys are still using clock
no fun cheating to help c++ guys
still using clock
c: 0.001, c++: 0.511
still senseless benchmark
@Luka mate, one result is meaningless you have to take average of many runs, and calculate standard deviation
@Luka Cheating?
How was I cheating?
14:23
@BartoszKP please tell me if 0.001 will became slower than 0.511 if I run it 1b times?
this is ridiculous. just plonk the fucker
@jalf but initializing vector with , 100)
@Abyx No, I think it's fair. He's doing a good job :)
@Luka That's not cheating, that's telling the vector to do exactly what you wanted it to do
@Luka I don't know, I just know that your result is meaningless - stop posting it, as if it proves anything
A vector always initializes its elements to some value. Malloc doesn't
14:24
calloc does
@jalf yes but what if i wanted to init with different values?
If what we want the program to do is "set everything to 100", then we should skip the initial "set everything to 0" step
And that is what I did
ok let's make it array[i] = i
@Luka Let's make a benchmark of it. :)
wait a moment
14:25
bah
and stop using clock
asking for so many contiguous elements brought down my computer.
please explain this: codepad.org/sAVS6nsM
You're right, by the way, about the corner case where your use case is simply "allocate a large chunk of zero-initialized memory". std::vector (in this implementation, at least) does not handle that as well as calloc does. But calloc is a special case, and I'm more interested in the general case
c: 0.051, c++: 0.077
14:26
@harold lol
@Luka He did explain it.
more than once.
your C++ and C code is not equivalent.
@DeadMG Lemme guess. Windows? Swap?
@jalf You can also do a funky custom allocator jobbie and solve that problem.
can anyone init the vector with i and make it faster than c array?
@sehe I've noticed that both Windows and Linux seem to hate it when you request too much RAM.
14:27
@Luka Same as before: your C version assigns to each element once. The C++ version is written to assign to each element twice
@Luka Gimme a sec.
@Luka Is initialization really the most interesting use case for an array though?
btw, wasn't the point to compare std::array with C-arrays? not std::vector?
@harold Both, I think
JBL
JBL
14:28
@Luka These are not the same things :/
does that second call to clock() include some of the output time too?
Usually, if performance matters, then the first thing you do is to preallocate the array, so the cost of malloc and the cost of initialization goes away
okay, in this case c++ is faster.
@Luka there are corner cases where you can do better than std::vector (complex initialization is one, although a custom allocator could fix that. Another is zero-initialization, where calloc is faster, although a std::vector implementation could use that as well
this is really stupid to argue about performance
14:30
@DeadMG Well, at least Linux just crashes the requesting party (if not programmed to handle errors)
Anyone have a good book or tutorial for network packets? I'm looking into making a simple server that parses packets sent by a client.
but you have to understand one thing:
@Luka see?
JBL
JBL
Indeed.
But those are corner cases. Try measuring performance when using the array, rather than when initializing it :)
14:30
you're not measuring difference between these implementations, but playing roulette on how OS will deal with allocating so much memory, and what OS was currently doing, at the moment when you hit the "submit" button .. :|
it's not right to say "never use c stuff"
@Luka I don't think so. I think it's been a good discussion :)
@sehe I experienced it crashing itself quite a few times.
@Luka you got it, finally
also, it's wrong to always use c stuff
14:31
@Luka Well, for the vast majority of C stuff, it is in fact quite right.
but really it depends on the case
@DeadMG Woot. When was this? Pre-OOM killer? 2001?
@Luka Well, technically you started out basically saying "never use C++ stuff" ;)
JBL
JBL
@DeadMG What if you only have access to a C compiler? The whole C-stuff becomes relevant!
@sehe A few weeks ago.
14:31
@P1raten a book on packets in your format?
std::vector is as fast or faster in the general case. But it is important and useful to be aware of the corner cases where a more specialized implementation can beat it
@Luka you failed to show even one case that proves anything substantial
user1804599
Linked lists are fast enough.
@BartoszKP c'mon i just prove it in those so called corner cases.
@rightfold somehow that offends me
user1804599
14:33
Good.
oh hey.
@Luka Yep. I'd never say "never use C arrays". But by default I prefer a vector or std::array because in typical cases, they aren't just "nearly as fast", but actually as fast.
@rightfold you can try writing your code in vb
I did write in VBA and it worked good.
Umm ... my Android app is a bit ... retarded ... for some reasons it keeps on playing the music even if I quit the app
14:34
@BartoszKP he showed several cases where the different is significant. Those aren't scenarios you commonly encounter (whichi s what makes them corner cases), but the difference in those cases was pretty significant
means ... I am retarded/inexperienced :'(
@Luka no you didn't. How do you know what OS was doing at the moment when the code was executed? You don't know what have you been measuring. That's why I said - one result is meaningless. Next time just use a simple loop to repeat the experiment N times.
@Telkitty it doesn't want you to abandon it
@Luka You didn't actually show any corner cases.
I got a review for the app - user could not stop the music :p
14:34
jalf made some vague allusions to some corner cases.
@DeadMG Amazing skills. You have to teach me that one day o.O
In slightly unrelated news, my mom's PC fails to login today, apparently creating new files with zero permissions. So, there's that. I wonder what triggered it.
@jalf without averaging it doesn't make sense. again: how do you know OS wasn't doing anything at the moment and interrupted the process?
jalf sucks
@DeadMG std::vector(size, 0) vs callloc(size)?
14:35
now after so much time, if i want to use c array in one "corner case", what's better: a) int func(int x*){ ... } b) int func(int x[5]){ ... }
wut?
@Luka those are identical. That's why C arrays are bad :p
please tell me or i will quite programming and because a fisher
@jalf Pretty sure you can dodge that using an allocator.
@jalf ok, thanks
14:36
do that
@Luka please do it
@Luka that's the best reason I've ever seen
Oh, actually ,will the second one even compile?
"because a fisher"
14:36
I don't think there is such a thing as callloc :P
Fisher did it
The (or a) problem with C arrays is that you can only pass them as pointers, and then you lose the size. That is not useful :)
I might use that when I'm not sure how to justify myself
maybe the word fisher doesn't exist?
14:37
how can programmers be real if our bits aren't real?
This can also make the code slower than a vector, because pointers are hard for the compiler to reason about. It doesn't know if the pointer aliases something else
@Abyx in my format? :D Im sorry, I'm just getting back into C++. :p
@harold Well, the quantum programmers had imaginary bits, so maybe they can't be imaginary, and they observed us and made us real.
@Luka I typically use C arrays if the size of the array is known at compile-time (so I don't have to malloc/new it), and if I don't have to pass the array to other functions (because then it would decay to a pointer, probably be slower, and definitely be more cumbersome to use)
@Luka you've made a typo - you wrote "because" instead of "become" - hence the jokes
14:39
So, how's crash day
Anything crashy yet
ask vlad
if a) i know the size of array, b) pass it to a function, what do you "recommend"
I crashed on my bad yesterday
std::array
I recommend jumping
@Luka go fishing already
@FredOverflow No
just as efficient, but you can pass it around as an actual array, rather than as a pointer
@BartoszKP ok, thanks
14:40
too much alcohol for jumping
and If you don't know the size at compile-time, use a vector
@Abyx here in greece we have awesome sea you simply can't beat but electronics are pricey :/
or maybe become a spill chucker
in the comedy genre
@jalf I don't think int x* is legal :)
haha
14:41
@BartoszKP no way. that's too obvious
@FredOverflow fair point :)
Just gonna repeat myself again snce im annoying like that:
Anyone have a good book or tutorial for network packets? I'm looking into making a simple server that parses packets sent by a client.
@sehe as opposed to crash day being completely non obvious
or curl?
why not use boost asio?
@P1raten Tanenbaum
14:43
@FredOverflow Computer Networks?
@P1raten No
Try FedEx, they have much experience with packets
5
@Luka because a fisher
@P1raten I usually find that I can get packets to their destination by placing them in some kind of mailbox.
@CatPlusPlus so funnneh
I also chant an incantation and place a ward on the package to protect it from the evil men.
14:44
@Jefffrey not sure why I live in this world
@DeadMG Or drop it in front of the door
if you don't place the ward they come and give it back to you and complain about payment.
@P1raten if you just want to build a network app in C++, take a look at boost asio and the accompanying tutorials.
Esp works if the packet is on fire and contains poo
oh yeah
I'd forgotten how cripplingly much I hate contacting other people.
14:45
also one friend in med from italy comes here soon... he's a good guy but i hope he doesn't became a surgeon
Other people is hell
you may say: i hope you luka doesn't become a programmer
isn't it already too late for that?
:'(
There is no hope
14:47
also, btw
@Luka I took an embedded Linux class from a guy who said his worst recurring nightmare was getting in a horrible accident and waking up connected to machines he designed
is is possible to crate a bot talk in chats like we do here>?
I crate bots all the time
@Luka Sure. Don't do it
Then ship them in packets
14:48
Never has so much trolling from so few been responded to by so many.
lol wat are you talking about
of course it has.
no really, how to make a program "talk" and response without getting a phd in ai?
has been often before, will be often in the future, and much more extremely.
We have many ways to make programs talk
@Luka #include <stdnlp>
14:49
just have it generate random gibberish with markov chains, it will be indistinguishable from what some real people write anyway
Try waterboarding
I am serious now, ehem, how?
@harold lol
can i do this? no guess, for the same reason we can't make robots be like humans
and for the same reason siri doesn't work 100% correctly and has limited functionality
No that's because Apple is not very good at computers
please I am (crash at line 85)
*on
14:53
:D
It's Apple bot, what'd you expect
lol
twist, we're all bots
bots with stylish hats
@ScottW from all the bots here, you're my favourite!
how to make a bot, please help me, i need help to beat gates in money
14:54
<3
JBL
JBL
@Luka Hint: a bot won't be enough :(
please help my flashlight crashed :/
2
my flight broke
:(
too bad
@ScottW tmi
14:57
it's too late for you guys
Yeah, we'll never be pretty princesses
I always wondered: how does isp work?
> It represents the force with respect to the amount of propellant used per unit time.[
JBL
JBL
@CatPlusPlus Too much Kerbal.
i mean how can they give so much bandwidth to costumers and hosting companies?
14:59
They pick wider tubes

« first day (1174 days earlier)      last day (3999 days later) »