|
Symbolic Butt posted:my guess is that APL people tend to be the kind of programmer who can create usable prototype algorithms in a fast way this p. much, finance is packed with first-mover advantages, if you make sure all your data is readily consumable in apl (or j/a/k) and have people practiced at it you can build the tools to get into some new type of instrument from one day to the next imho to some extent a feature of apl and friends in that there is huge efficiency in working on a codebase which fits in your field of vision
|
# ? Nov 23, 2016 09:41 |
|
|
# ? May 18, 2024 03:02 |
|
Sapozhnik posted:Go and JavaScript are the current hipste ya with rust as the "so underground it hurts" hipste
|
# ? Nov 23, 2016 14:43 |
|
i dont think rust is very underground. i feel like it has a ton of momentum right now, it's just that it's super ambitious and has a long way to go before it's really production ready.
|
# ? Nov 23, 2016 15:36 |
|
you could say it has a lot of rust to shed
|
# ? Nov 23, 2016 20:16 |
|
so, I lost the source code to a really simple tool I wrote for work, and I thought to myself: let's rewrite it in c++! so that I can finally learn some c++14 what the tool does is simple: reads from stdin or a list of files, xors them with a fixed rolling key, writes the result to output. the temptation is to structure it like this: C++ code:
I need a I/O bound thread to do the reading, a CPU bound thread to do the decoding, and a third I/O bound thread to write to stdout. no multiplexing, gently caress multiplexing, that's the OS's work. I already have one thread (the main thread) and I'll use it for writing, so that the whole thing will work like I started two subprocesses in a pipe to read what comes out. what I don't have, and I will have to write first, is a pipe. for how useful pipes are, no framework seems to implement them, and the c++ stdlib is no exception. so let's write our first class! C++ code:
many hours later: C++ code:
|
# ? Nov 29, 2016 15:57 |
|
hackbunny posted:so, I lost the source code to a really simple tool I wrote for work, and I thought to myself: let's rewrite it in c++! so that I can finally learn some c++14 here i made you one in java Java code:
|
# ? Nov 29, 2016 16:10 |
|
yosposting at its finest
|
# ? Nov 29, 2016 16:29 |
|
how is what you posted different from a SPSC queue eg http://www.boost.org/doc/libs/1_62_0/doc/html/boost/lockfree/spsc_queue.html
|
# ? Nov 29, 2016 16:45 |
|
i ask in large part because i use spsc queues as pipes frequently unless i have no idea what a pipe is, what a spsc queue is, or
|
# ? Nov 29, 2016 16:46 |
|
hackbunny posted:yosposting at its finest ty friend
|
# ? Nov 29, 2016 16:51 |
|
there's no such thing as a "simple tool" written in C++
|
# ? Nov 29, 2016 16:59 |
|
jesus christ hackbunny
|
# ? Nov 29, 2016 17:01 |
|
Sweeper posted:here i made you one in java
|
# ? Nov 29, 2016 17:07 |
|
hackbunny posted:// signaling eof with an exception actually i'm not sure i want to use this code if it'll make me simpler
|
# ? Nov 29, 2016 17:08 |
|
Bloody posted:how is what you posted different from a SPSC queue eg http://www.boost.org/doc/libs/1_62_0/doc/html/boost/lockfree/spsc_queue.html e: nevermind spsc_queue is what I should use instead of deque. the difference between object_pipe and spsc_queue is that spsc_queue is entirely wait-free, which means you have to add a mutex and condition variable yourself if you want to wait until some data is available. which makes it a replacement for deque (for queue actually, because spsc_queue is not double-ended), not object_pipe hackbunny fucked around with this message at 17:12 on Nov 29, 2016 |
# ? Nov 29, 2016 17:08 |
|
I'm morbidly curious about how they made a lock-free queue, which is notoriously harder than a lock-free stack, but I doubt the implementation is human-readable e: oh easy, they use a ringbuffer instead of a linked list hackbunny fucked around with this message at 17:19 on Nov 29, 2016 |
# ? Nov 29, 2016 17:15 |
|
in the spirit of fairness and reinventing the wheel buggily, feel free to mock my current stupid spare time project (a "game" in Rust): https://github.com/djmcgill/Vox-Machina
|
# ? Nov 29, 2016 17:16 |
|
gonadic io posted:in the spirit of fairness and reinventing the wheel buggily, feel free to mock my current stupid spare time project (a "game" in Rust): https://github.com/djmcgill/Vox-Machina how has perf been with rust? I've been wary of pushing it at work as an experimental thing since I have no idea how it performs in non-micro contexts
|
# ? Nov 29, 2016 17:34 |
|
hackbunny posted:I'm morbidly curious about how they made a lock-free queue, which is notoriously harder than a lock-free stack, but I doubt the implementation is human-readable ring buffers are gods data structure/thing of concurrent helpfulness
|
# ? Nov 29, 2016 17:34 |
|
Sweeper posted:how has perf been with rust? I've been wary of pushing it at work as an experimental thing since I have no idea how it performs in non-micro contexts Performance equivalent to c++ is one of its major features so go nuts on that front, lots of no-overhead poo poo. It is past 1.0 and released now, but the infrastructure and 3rd party langs aren't the most mature right now so bear that in mind
|
# ? Nov 29, 2016 17:47 |
|
C++ code:
hackbunny fucked around with this message at 18:06 on Nov 29, 2016 |
# ? Nov 29, 2016 18:04 |
|
i'm more concerned about why you'd ever want to apply a "rolling xor key" to a file, ever, particularly since you use the word "key" there is literally no situation where this is ever the correct thing to be doing to some poor innocent piece of data. other than perhaps the very first example in the very first lecture of a cryptanalysis 101 course
|
# ? Nov 29, 2016 18:05 |
|
Sapozhnik posted:i'm more concerned about why you'd ever want to apply a "rolling xor key" to a file, ever, particularly since you use the word "key" don't ask
|
# ? Nov 29, 2016 18:07 |
|
don't roll your own crypto. (u less you are iot things)
|
# ? Nov 29, 2016 18:31 |
|
Sapozhnik posted:i'm more concerned about why you'd ever want to apply a "rolling xor key" to a file, ever, particularly since you use the word "key" an xor can make a good enough fingerprint depending on the number of bytes fingerprint not being security related Sweeper fucked around with this message at 19:24 on Nov 29, 2016 |
# ? Nov 29, 2016 19:20 |
|
Boiled Water posted:roll your own crypto. it's fun, and what could possibly go wrong?!?!?!?!?!
|
# ? Nov 29, 2016 20:19 |
|
besides, if you make your own crypto it's unbreakable because nothing else uses it!
|
# ? Nov 29, 2016 21:17 |
|
hackbunny posted:lots of code Always use condition_variable::wait overload that takes a predicate, its neat. Also I am not entirely sure about your cv notifications, I think you can simplify them since you are assuming SPSC, but gently caress reasoning about threads after 6 beers. --- Also I think the case of calling cv::notify under mutex is common enough to have optimized implementation, but ymmv.
|
# ? Nov 29, 2016 21:35 |
|
Wheany posted:besides, if you make your own crypto it's unbreakable because nothing else uses it! well exactly. no nsa backdoors, guaranteed.
|
# ? Nov 29, 2016 22:07 |
|
u guys realize they're called concurrency primitives for a reason right
|
# ? Nov 29, 2016 22:08 |
|
Sapozhnik posted:u guys realize they're called concurrency primitives for a reason right yes, it's so primitives can use them
|
# ? Nov 29, 2016 22:23 |
|
Xarn posted:Also I am not entirely sure about your cv notifications, I think you can simplify them since you are assuming SPSC, simplify, or suppress spurious notifications? because "notify always no matter what" seems simple enough. it's hardly the most pressing issue though: what about the fact that I'm doing some allocations without the specified allocator?! but seriously the lack of variant is going to majorly loving suck Xarn posted:Also I think the case of calling cv::notify under mutex is common enough to have optimized implementation, but ymmv. I know and I have written such an implementation at the dawn of time, but going by cppreference, it's not guaranteed
|
# ? Nov 29, 2016 22:54 |
|
i looked variant up, and "The class template std::variant represents a type-safe union. An instance of std::variant at any given time either holds a value of one of its alternative types, or it holds no value" this is only in c++17??
|
# ? Nov 29, 2016 23:11 |
|
hackbunny posted:simplify, or suppress spurious notifications? because "notify always no matter what" seems simple enough. it's hardly the most pressing issue though: what about the fact that I'm doing some allocations without the specified allocator?! Supress spurious notifications, allocators can suck it. Also look at the bright side of this, C++17 is not that far off. gonadic io posted:i looked variant up, and Do you know how many ways there are to bikeshed a variant? Because if not, look standardization process around std::variant and std::optional
|
# ? Nov 30, 2016 00:12 |
|
i forgot that c++, like haskell, follows the design-by-mailing-list approach
|
# ? Nov 30, 2016 00:16 |
|
gonadic io posted:this is only in c++17?? not just that, it hasn't even been officially implemented yet. I can #include <experimental/option> but I can't #include <experimental/variant>. I think maybe boost has it but I'm trying to learn standard C++, not boost it couldn't have been done earlier than c++11 or 14 either because of language and stdlib defects (although all compilers had proprietary workarounds) and don't ask how pattern matching is done because you don't want to know. c++, much like java, suffers from chronic nameism. a lot of the work done for c++11 and since has been aimed at gradually reducing the need to name so many things Xarn posted:Supress spurious notifications, allocators can suck it eh, I'll make it a TODO. bespoke artisanal variant first. allocators can suck it, otoh I never learned allocators and this is first and foremost a learning experience Xarn posted:Do you know how many ways there are to bikeshed a variant? Because if not, look standardization process around std::variant and std::optional variant is incredibly complicated and I'm not surprised it took a long time to agree on an interface. I tried writing my own but I couldn't figure out how to write the non-member get<> method. I looked at how it was defined for tuple and came out with a headache. we either need an iterative style for templates or at least a declarative syntax that isn't so drat abstract and verbose. maybe around 2030 or so, provided they'll have agreed on concepts by then
|
# ? Nov 30, 2016 00:41 |
|
gonadic io posted:i looked variant up, and There is a lot of stuff that is surprisingly c++17 or later, I was recently surprised with map::insert_or_assign. For a spiffy SPSC queue read you a Lynx Queue, using page faults around a ring buffer to avoid socket contention on the head/tail pointers.
|
# ? Nov 30, 2016 00:48 |
|
gonadic io posted:i looked variant up, and i wish i could show you the massive amount of discussion regarding "what if exceptions are thrown during copy constructors when copying the variant" and what people wanted to do ("well just allocate. works for me!", "let the program be in a bad state", "just call abort", "throw a nested exception, who cares"). All because boost::variant has the never empty guarantee, and people wanted that to be the default. (so default constructing a variant default constructs the first type in its template list) the fact that a compromise was reached among the committee's different factions so quickly regarding this is nothing short of a miracle btw hackbunny, i feel yr pain regarding the allocator thing. makes it a nightmare to make a generic soa_vector type, so you're stuck with either putting the allocator first, or doing some really wacky and weird poo poo with template aliases, or even template templates. hackbunny posted:
might i point you to a library I wrote so people on C++11 can get all the tasty goodness of future library features? it actually started life in this thread like 3 years ago when famdav (maybe?) asked about a polymorphic deep copying type and i wrote a type as a joke (hilariously enough, there's now a polymorphic_value<T> type being submitted to the committee). now it exists in some form or another at bittorrent, apple, mongodb (lol), and a german telecom startup deployed an early version of it to a few thousand boxes. allocators are butts and not the good and smooth and gay kind. we might end up getting saved by a 19 year old german kid who is currently designing a more extensive less bullshit system of allocators, but i dont think we'll ever fix the realloc problem hackbunny posted:variant is incredibly complicated and I'm not surprised it took a long time to agree on an interface. I tried writing my own but I couldn't figure out how to write the non-member get<> method. I looked at how it was defined for tuple and came out with a headache. we either need an iterative style for templates or at least a declarative syntax that isn't so drat abstract and verbose. maybe around 2030 or so, provided they'll have agreed on concepts by then the get is the easy part, its the loving matching thats is a nightmare, and i still dont know why they didnt make visitation just take no more than 2 variants, because that is easy to implement, but no we have to have a function go first and then any variable number of variants instead of the other way around. (im so mad that overload didn't make it in because it would ease my suffering) all i want is my lil intrusive smart pointer proposal to get into c++20 and i will die a happy dumb gay nerd
|
# ? Nov 30, 2016 01:02 |
|
hackbunny posted:not just that, it hasn't even been officially implemented yet. I can #include <experimental/option> but I can't #include <experimental/variant>. I think maybe boost has it but I'm trying to learn standard C++, not boost boost has had it for 14 years, but std::variant is significantly different (mostly better, sometimes just different). part of why it's taken so long to get into the standard is because boost.variant had a bunch of issues that were nontrivial to resolve, while the boost things that landed earlier only had relatively trivial problems
|
# ? Nov 30, 2016 01:14 |
|
|
# ? May 18, 2024 03:02 |
|
Slurps Mad Rips posted:allocators are butts and not the good and smooth and gay kind. we might end up getting saved by a 19 year old german kid who is currently designing a more extensive less bullshit system of allocators, but i dont think we'll ever fix the realloc problem what's the realloc problem? I stopped caring about allocators when I found they couldn't be written as adapters for lots of common allocators, and EA's paper on their gamedev stl validated me. it seems some (all?) of those issues were finally addressed and I pleasantly note that deallocate's size argument can now be, basically, ignored (still no idea why it even has a size argument) Slurps Mad Rips posted:the get is the easy part huh, you're right, I was overthinking it. I'm still very unfamiliar with type_traits, vararg templates etc. because back in my day we had to trait our types uphill both ways etc. except for one thing: C++ code:
|
# ? Nov 30, 2016 01:32 |