« first day (1757 days earlier)      last day (3192 days later) » 

12:00 AM
@nick Mumblel
 
@Nooble mumble lels?
 
@jaggedSpire Yes.
 
@StackedCrooked Solution is: Don't make it multiple GB large.
 
ISIS = Internation Space ISIS Station
 
I guess..
 
user1804599
12:09 AM
> for x in List.rev [ 0 .. 1 ] do
 
user1804599
wtf why didn't I just write for x in [1; 0] do lol.
 
user1804599
@orlp Do they sit on a rotating plate because they have to face Mecca while praying?
 
@elyse fun fact - in non-euclidean geometry you can pray facing anywhere, since the line WILL hit mecca
 
user1804599
murecca
 
user1804599
asleep
 
user1804599
12:20 AM
bye!
 
@ScottW in the no-dogs zone
sorry, but your name gives you away: Scott Woof
hrm
say hi to noobel from me
actually, no
mute/unmute like a couple dozen times
 
@Mysticial Sensei has spoken :O
 
Wikipedia's article on the circular buffer is quite comprehensive:
A circular buffer, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams. == Uses == The useful property of a circular buffer is that it does not need to have its elements shuffled around when one is consumed. (If a non-circular buffer were used then it would be necessary to shift all elements when one is consumed.) In other words, the circular buffer is well-suited as a FIFO buffer while a standard, non-circular buffer is well suited as a LIFO buffer. Circular buffering...
 
@StackedCrooked obligatory self-promotion github.com/orlp/devector
 
@ScottW k
 
12:26 AM
obligatory message: devector implementation is incomplete, need to implement a couple more features (insert/emplace)
exception safety is a bitch
 
does it have cheap pop_front?
 
@StackedCrooked yes
@StackedCrooked both push_front and pop_front are amortized O(1)
 
Apparently, lockless circular buffers are common in HFT. I can't go into details though since I don't know what's common knowledge vs. proprietary.
 
@Mysticial HFT?
 
Man I wish Google would fix their shit, my Nexus 7 hasn't been working fine since Android 5
:(
 
12:33 AM
@Mysticial isn't that single-reader single-writer though, so that there's never a collision of interest?
 
@orlp High Frequency Trading
 
I think lockless circular buffer is definitely common knowledge, and if not, allow me to share my technique I literally just made up
the reader only cares about incrementing the read pointer, the writer only cares about incrementing the write pointer
tadaa
no locks needed (still need proper memory ordering)
 
void is literally Hitler
magic type that's completely non-generic
 
@Mysticial it's in boost as well: boost.org/doc/libs/1_54_0/doc/html/atomic/…
 
I know lockless circular buffers are common knowledge. But I don't know which implementation details of our implementation are common knowledge vs. proprietary.
 
12:38 AM
@Mysticial Are they like the disruptor?
 
Can't assign, and if I do typedef void some_type I can't even say some_type[] (even as a template parameter, where that would make sense)
 
@Mysticial The thing is, the implementation I linked is 'perfect'
 
@StackedCrooked lol, I'm not familiar with that pattern.
 
in that you literally can not do any less work
 
Morning
 
12:40 AM
@orlp No it isn't.
 
unless your requirements/specs are different than a single-reader single-writer fixed size ring buffer, then this is the way to g
 
@orlp Yes, you can do less work.
 
@Mysticial I don't understand - the implementation I linked does the same amount of work as an implementation that is non-threading, except with proper memory ordering
unless you want to go into architecture specific memory ordering/barrier options, this is as optimal as it gets
 
Here's a piece of advice: Open-sourced implementations are not always the best implementations. Sometimes, the proprietary stuff can actually better. (in this context, better == faster)
 
@Mysticial I know.
@Mysticial but are you talking about architecture-specific optimizations?
or portable C++ code?
 
12:50 AM
@Mysticial can actually better?
 
@orlp lack of batching is a big one. easy to add though.
 
@Borgleader fuck, too late to edit
 
Hello
Someone understand HEX IR codes?
From possibly Remote controls
I'm searching for the meaning of ones.
I received them from unknown source.
 
DBE32B77
F00994DA
F2EAE9C4
 
12:51 AM
@orlp also probably needs padding between the head and tail counters.
 
If someone could tell me what they mean
 
Is this guy trolling?
 
I'll be gratefull.
Thanks.
I'm not
Nope
Really
 
stop
 
12:53 AM
@FISOCPP wow is google ever useful
 
Well I searched them directly with no result.
 
Well duh
 
That was like the fourth result for "HEX IR codes"
 
I know but I mean for the codes themselves
 
The amount of ppl on SO who claimed to have googled but didnt is too damn high
 
12:54 AM
I don't want to scroll through thousands of code.
If there is a faster way
 
@FISOCPP I don't want to scroll through all your messages
 
@FISOCPP what did you expect to get from a search of hex numbers? That's like searching 1234538323
 
@StackedCrooked no, that's different
that's multi-consumer/producer
@StackedCrooked and if you'd read the steps from the single-consumer implementation - that's literally what the boost one does
 
@jaggedSpire stop using logic :(
 
12:59 AM
@Borgleader okay, mango
 
@StackedCrooked did you look at the disassembly?
pushi:
	movq	buf+128(%rip), %rcx
	movq	buf+136(%rip), %rsi
	xorl	%eax, %eax
	leaq	1(%rcx), %rdx
	andl	$31, %edx
	cmpq	%rsi, %rdx
	je	.L2
	movl	%edi, buf(,%rcx,4)
	movl	$1, %eax
	movq	%rdx, buf+128(%rip)
.L2:
	rep; ret
 
what is this about?
 
the circular buffer
 
Heads up: we will be doing a failover of all services to our DR data center tomorrow to prep for network maintenance. http://stackstatus.net/post/126135656099/data-center-failover-august-8-2015
 
that's the push disassembly
 
12:59 AM
what is good about it?
 
that it's as short as can be?
 
less assembly instructions doesn't always mean faster code
 
something something strength reduction
 
@unordered_meow no shit
 
2 mins ago, by orlp
that it's as short as can be?
 
1:03 AM
yes - but longer code must be relevant - in this case it's not
 
@orlp boost::atomic<size_t> head_, tail_;
This doesn't look wrong?
 
@StackedCrooked enlighten me?
 
False sharing?
 
also I used std::atomic
 
boost's spsc_queue and lockfree stack are much better examples
 
1:07 AM
@StackedCrooked I don't know enough about parallelism in modern CPUs to either support or oppose that complaint
 
It allows for pushing/popping multiple items in one go.
Also look at it's memory layout:
    typedef std::size_t size_t;
    static const int padding_size = BOOST_LOCKFREE_CACHELINE_BYTES - sizeof(size_t);
    atomic<size_t> write_index_;
    char padding1[padding_size]; /* force read_index and write_index to different cache lines */
    atomic<size_t> read_index_;
Padding is important.
@orlp The MESI protocol is the place to start. Takes only 30 minutes to grasp :)
The MESI protocol (known also as Illinois protocol due to its development at the University of Illinois at Urbana-Champaign) is a widely used cache coherence and memory coherence protocol. It is the most common protocol which supports write-back cache. == States == Every cache line is marked with one of the four following states (coded in two additional bits): Modified The cache line is present only in the current cache, and is dirty; it has been modified from the value in main memory. The cache is required to write the data back to main memory at some time in the future, before permitting any...
 
@StackedCrooked Awesome read
 
@StackedCrooked I have no doubts - the new version I linked is fixed, right?
 
1:19 AM
@orlp It's better. But the head counter overlaps with the data. But that's not a big issue probably if the buffer is large.
 
@StackedCrooked again I don't know enough to know if that needs changing or not
either way, IDC, wasn't planning on using the ringbuffer anyway
writing lock free code is an excercise that I'll keep at an excercise :P
 
Oops, my code use of std::endl between reads could skew the results. Here's a fixed version.
 
omfg yes
gimme gimme gimme gimme gimme gimme gimme gimme gimme gimme gimme gimme gimme
 
@StackedCrooked isn't it bedtime @ 3.30 am?
 
/cc @AlexM. @nabijaczleweli
 
1:28 AM
It's never bedtime in the Lounge.
only lurktime.
 
fuck me
I saw a banana on the internet
now I have an irrational overwhelming desire to consume a banana
 
@Mysticial I certainly believe you. The most advanced open-source code I've found comes from Folly (Facebook) and the Intel DPDK library. I wonder how they compare with the commercial ones.
IIRC many lockfree algorithms are patented too.
So that's a bummer for open-source.
 
@StackedCrooked you can make an open-source implementation of a patented algorithm AFAIK
running it without permission is illegal
 
@StackedCrooked The other reason I say that is because I get pestered twice a month about my pi program and the bignum library beneath it.
Mostly from open-source fanbois.
 
@Mysticial the reason I'm skeptical about you saying your propietary implementation could be better is simply because I don't see the opportunity for optimization in the generated code for the example I gave above - I never meant to claim in general that open source is always better
 
1:35 AM
Thing is that boost libraries are intended for general-purpose. I often find that in order to make things fast you need to tune it for very specific use cases.
 
(with, again, the exception of architecture-specific optimizations)
 
@orlp It's not my implementation. It was already there when I joined the company. But I've been using it a lot.
 
@Mysticial hrm, maybe this is a dutch only thing?
we can refer to something as 'your blablabla' where the 'your' does not imply ownership or authorship, but merely the thing that was introduced into the conversation by you
that's the 'your' I meant :)
 
Can you name the proprietary software library that you are using? Or is it in-house?
 
@Mysticial Will Intel ever release a mainstream 6 core processor? I feel like we've had quad cores for long enough :(
 
1:38 AM
personally, I strongly believe in open-source, but more from an idealist perspective than a realist one
 
@StackedCrooked It's in house. And based on the file names, there's been at least 2 or 3 previous versions of it that are no longer in use and deleted.
 
a lot of open source fanbois VASTLY overestimate the AMOUNT of people involved in MOST open source code
usually it's a 1 man show, and in almost all the cases it's <5
 
@Mysticial Sharing is better than deleting :)
 
@Mysticial relevant xkcd:
 
lol
 
1:44 AM
@Mysticial but your current gig is only HPC?
 
What do you mean?
 
is performance tuning your main role, or is it just a side thing at your current employer
feel free to also use the 'none of your business-card' at any time
 
There's no fine line.
I'm largely implementing new features, but all of it is performance oriented.
 
Are you more focused on improving latency or on improving throughput?
 
@StackedCrooked I assume latency is the critical part
 
1:46 AM
Latency for the trading systems. Throughput for the research farm.
 
throughput is aways solvable with more machines
for varying degrees of always
@Mysticial are there a lot of similar job openings, or is it more of a unicorn?
I'm asking mainly for personal interests
 
Hey guys
Is it viable to use a type factory class to change a string into a specific type?
 
how many such jobs are there (performance focused), and how much competent competitors to compete for the same job opening
@VermillionAzure depends on what programming language
if it's something like Python it can be entirely reasonable
if it's C++ you're probably doing something wrong
also a bit more details about the problem are needed
 
@orlp I actually don't know. I assume most of this is between headhunters and CEOs.
That said, I see plenty of HFT job ads on SO.
 
1:50 AM
@Mysticial I'm unfamiliar with the term headhunters?
 
@orlp Yes, in C++
 
@orlp They're called snipers.
 
Someone wants to create a variable-type templated class based on user input
 
You don't have to hit them in the head. But it's more effective if you do.
 
So, I thought that creating an associative map between the strings/keys and the types would be nice, except you cannot pass type literals in C++.
 
1:51 AM
 
Then I realized that having a templated class that creates a variable wrapped in a class that used decltype() to derive a specific templated type would be nice.
 
^^ Yeah. All financial.
 
@Mysticial US, US, US, US :)
 
@orlp What do you think?
 
that said, I am a US citizen, so it won't be a problem
I don't want to live in the US though
@VermillionAzure you're probably doing something wrong
 
1:53 AM
If you're a US citizen and you plan on living outside the US permanently, you might as well get rid of your citizenship or get double-taxed.
 
@VermillionAzure you probably want to do proper parsing
 
@orlp It's not my problem.
 
@VermillionAzure Mr. I-want-templates-from-user-input?
 
@orlp Pretend we have the tokens.
 
@Mysticial I'm 20, I don't feel informed enough to make such a decision
 
1:53 AM
0
A: Creating an object of specific type based on user input

VermillionAzureI don't like your method of doing it because it's too long and messy. If I were you, I'd set up an associative map between string input and types, and then pass the types to the template once you've correctly converted from input to type. Unfortunately, because you cannot play directly with typ...

 
...
...
 
@orlp Oh okay. That I don't know since I don't have this problem.
 
11
Q: Storing a type in C++

perimosocordiaeIs it possible to store a type name as a C++ variable? For example, like this: type my_type = int; // or string, or Foo, or any other type void* data = ...; my_type* a = (my_type*) data; I know that 99.9% of the time there's a better way to do what you want without resorting to casting void po...

I got my answer from the second one with the allocate object
I'm just wondering if I can unify the scattered templated types in a wrapper class so I can stick it into a std::unordered_map
 
@VermillionAzure All this would be even an issue if C++ had better enums
Fuck C++ enums
 
@unordered_meow I'm just disappointed I don't have a smooth option to use dynamic typing in C++
Or, at least a framework or something to allow it.
boost::variant and boost::any make it hard to derive an actual type to be used in declarations of variables or function parameters, etc.
 
1:57 AM
Well duh
In fact now that I see this question he probably should be using boost::variant
 
@unordered_meow True that.
But it's nice to have a variant type that can be reliably narrowed into a static-type without having this dangerous casting stuff.
 
Also I sense a bit of XY problem there
 
@unordered_meow It's bad design, but there's cases where it's nice to have type info avaliable
converting a string to type would be one of them
 
@VermillionAzure ...just like Boost.Variant's visitors (see bottom of the page)
No dangerous casting stuff
 
@unordered_meow That's not what I meant though
I meant that I can directly extract the type of the variant
I don't think I'm understanding this properly
 
2:02 AM
Take a deep breath
 
Ahhh fuck but ughhhhhh
If you create a visitor that goes over it by type, that also means that I need to have a type on failure
 
What failure
 
@unordered_meow I want a function that correctly returns the underlying type from a variant
 
For what
 
Without defining the type
@unordered_meow I just posted the question, sheesh.
I want a way to convert user input of tokens into specific types or whatever
so "a" ==> int or some other class.
 
2:04 AM
@VermillionAzure If your visitor can't be called with all the possible variant types, then there's a compiler error
 
@unordered_meow No, that's not what I meant.
I just want a direct conversion of key to type, and then create a variable based on that type
 
@VermillionAzure I can do this, but not the thing the asker wants
 
@unordered_meow How do you do that.
 
IOW all n^2 combinations of the types
@VermillionAzure Wait a sec
 
@unordered_meow Just write it out
I don't need a working example
in other news, Rightfold has another language? O_O
 
2:17 AM
rightfold always has another language. It's one of the rules.
 
@unordered_meow without a base class
@unordered_meow Also, that's MACRO MAGIC. TRIGGERED.
 
@VermillionAzure I could probably do that with boost::variant and requiring types to be comparable with each other
@VermillionAzure Not for the faint of the heart
Also there are parts of Boost that are even worse than this
 
2:33 AM
@unordered_meow I think it's better to maybe have a switch function already. God.
But then this means we don't have a high-performance variant automatic unpacking method.
@unordered_meow Which is why I shun most of the macro heavy Boost libraries.
 
Used x-macros last year for generating an exception hierarchy for an rpc library. It worked amazingly well.
 
@VermillionAzure rotfl
X-macros are for now the only usable way to get automatic conversion between enums and strings
You can do a fairly good job at getting a no-macro "next-gen enums" if you don't need that
 
oh god
OH GOOOOOOOOOOOOOD
no just no just no just no
 
@VermillionAzure ?
 
@unordered_meow Can you come up with a factory based one with raw C++?
 
2:44 AM
There should be IOC++CC
 
@unordered_meow Can't you do something where you have a factory class that returns a smart pointer to the type you gave its template and then wrap that in a wrapper class?
So it can be used in a vector/container with a uniform type?
 
Trying to parse that statement
> a smart pointer to the type
 
@unordered_meow s/type/variable of the type/
 
@VermillionAzure Now the part "you gave its template"
Passing C++ template or general term template
 
@unordered_meow template <class T> allocator {//returns a variable of type T when invoked};
class allocator_wrapper { allocator_wrapper(auto a) { //gets type of a and then shoves it into allocator } };
is that viable
 
2:50 AM
Yeah, the problem is that you have to provide such allocator wrappers for every such type
A mapping between a string and a C++ entity
 
@unordered_meow why for each type?
can't i derive the type of the variable in the constructor?
 
Yeah, now what
 
@unordered_meow I mean, can you do something like allocator<decltype(a)>? with having type equvivalence in terms of templates when you place it into std::vector<allocator_wrapper>?
 
@VermillionAzure So you want to have an allocator<decltype(a)>, and push it into vector of allocator_wrappers.
Now you have two problems
One, you don't have mappings between external entities (the strings) and the internal entities (position of the allocator_wrapper in the vector, variables, types, templates, what have you)
Two, allocator_wrapper has one return type
Also congratulations, you reinvented std::function
You have everything that's needed to write one
 
@unordered_meow I'd instantiate an allocator per type and then put it into a map.
But I want the wrapper to be the type that's held in the array or else I'd have to have another variant which defeats the purpose
 
2:59 AM
Argh, guys can be so annoying. This asshole was asking my friend to walk her home the whole night. "No" is really hard to understand for some people.
 
@R.MartinhoFernandes Is this implying Robot is not a guy? o_o
 

« first day (1757 days earlier)      last day (3192 days later) »