|
Hard NOP Life posted:Use Java shaggar??
|
# ? Sep 3, 2013 21:43 |
|
|
# ? Jun 1, 2024 06:34 |
|
Cocoa Crispies posted:lol but at the same time That's why you go from python to c#/java and get a 500x speed up in runtime and a 20x speed up in dev.
|
# ? Sep 3, 2013 21:53 |
|
also threads are really easy. you just need to make sure that none of them know that the others exist.
|
# ? Sep 3, 2013 22:06 |
|
b-b-but of course Shaggar posted:also threads are really easy. you just need to make sure that none of them know that the others exist. shaggar is right to not suffer and thread, is to use C#
|
# ? Sep 3, 2013 22:16 |
|
threading poo poo in a way that work can be easy threading poo poo in a way that works and that actually performs better than not using threads is harder, there's lots of performance pitfalls
|
# ? Sep 3, 2013 22:32 |
|
Shaggar posted:also threads are really easy. you just need to make sure that none of them know that the others exist. this is absolutely fine. the task im handling is trivially parallelized - nothing any thread is doing has any impact whatsoever on the other threads. The individual tasks are relatively long - as much as half an hour of serial execution. this triviality scales well to hundreds of cores and terabytes of ram, which has the downside that i cant just spawn a thread for each task and wait for all of them to finish at once. changing languages is unfortunately not an option at all for a variety of uninteresting reasons. im using gcc 4.7 so whatever is available there is available to me
|
# ? Sep 3, 2013 23:05 |
|
4.7 doesn't have the new memory model, but iirc stdlibc++ supports the new std threading library
|
# ? Sep 3, 2013 23:07 |
|
Mido posted:b-b-but of course I've never done thred pooling in c# but in java its kewl and ez to fire up an executor w/ some params and shove in crap while u wait for the futures
|
# ? Sep 3, 2013 23:11 |
|
if you gay boys want to hear some c++ threading knowledge i guess lusten to this http://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Herb-Sutter-Concurrency-and-Parallelism
|
# ? Sep 3, 2013 23:13 |
|
Bloody posted:this is absolutely fine. the task im handling is trivially parallelized - nothing any thread is doing has any impact whatsoever on the other threads. The individual tasks are relatively long - as much as half an hour of serial execution. this triviality scales well to hundreds of cores and terabytes of ram, which has the downside that i cant just spawn a thread for each task and wait for all of them to finish at once. have a look at intel's tbb library: https://www.threadingbuildingblocks.org/ it provides a lot of tools to simplify writing parallel algorithms while avoiding a lot of performance hazards. for instance the amount of work that each parallel task does is tricky to get right: if you dispatch too many small tasks you're going to have too much overhead with the tasks dispatching, and its better to process a bunch of consecutive data in a given task to better use the cache etc. thread building blocks have generic algorithms like parallel_for that takes care of this kind of gory details for you (theres some reasonable default heuristics for that which you can tune if you want). it also provides an efficient parallel memory allocator (traditional memory allocators tend to serialize allocations between threads so memory allocation can easily become a big point of contention), lock-free containers etc.
|
# ? Sep 3, 2013 23:33 |
|
Zlodo posted:have a look at intel's tbb library: https://www.threadingbuildingblocks.org/ owns
|
# ? Sep 3, 2013 23:56 |
|
Python was one of the initial projects included in the Coverity Scan service, which enables the open source community to find and fix critical quality and security defects in their code. Since 2006, Python has achieved a defect density of .005 (or .005 defects per 1,000 lines of code) and has eliminated all high-risk defects in its codebase. p-langs win again
|
# ? Sep 4, 2013 00:24 |
|
not much to fix when your lang is for babbys
|
# ? Sep 4, 2013 00:26 |
|
it's called python because it's a hugbox for bad programmers
|
# ? Sep 4, 2013 00:37 |
|
chumpchous posted:it's called python because it's a hugbox for bad programmers not surprising how popular it is at google
|
# ? Sep 4, 2013 01:04 |
|
jooky posted:shaggar?? I'm shaggar lite
|
# ? Sep 4, 2013 01:24 |
|
spongeh posted:Python was one of the initial projects included in the Coverity Scan service, which enables the open source community to find and fix critical quality and security defects in their code. Since 2006, Python has achieved a defect density of .005 (or .005 defects per 1,000 lines of code) and has eliminated all high-risk defects in its codebase. so coverity pays a dude to go through the cpython code and put #define COVERITY_IGNORE_THIS in the right places
|
# ? Sep 4, 2013 01:37 |
|
otoh not too long ago ruby had an honest-to-god bug in Array's bounds checking. a p-lang that would let you smash the stack then ruby-core hosed up fixing it lol
|
# ? Sep 4, 2013 01:40 |
|
c thread s: implemented some simple boost::threading in my thing. compiles but needs testing. gently caress thread pools, i keep track of my threads in a vector and throw out used ones when they're done. when each thread will be running for at least ten minutes of 100% cpu work i don't care about whatever that overhead might be. now i have to think about how i get my program output out of these threads gently caress
|
# ? Sep 4, 2013 02:03 |
|
oh i know instead of spamming poo poo to cout i will make a vector<vector<string> > and pass each thread its own vector<string> and then that thread will push_back instead of cout
|
# ? Sep 4, 2013 02:11 |
|
also the boost lib that apt-get installed is a fair bit older than the current release so now i am yak shaving to install the latest release
|
# ? Sep 4, 2013 02:13 |
|
Bloody posted:oh i know instead of spamming poo poo to cout i will make a vector<vector<string> > and pass each thread its own vector<string> and then that thread will push_back instead of cout either use a premade thread safe fifo queue class thing or use mutexes smartly
|
# ? Sep 4, 2013 02:13 |
|
Bloody posted:> > lol
|
# ? Sep 4, 2013 02:14 |
|
Bloody posted:c thread s: implemented some simple boost::threading in my thing. compiles but needs testing. gently caress thread pools, i keep track of my threads in a vector and throw out used ones when they're done. when each thread will be running for at least ten minutes of 100% cpu work i don't care about whatever that overhead might be. do you not have a c++11 enabled compiler or what just split up your work, push back async calls to your work into a vector of futures, then wait on every future.
|
# ? Sep 4, 2013 02:18 |
|
Bloody posted:c thread s: implemented some simple boost::threading in my thing. compiles but needs testing. gently caress thread pools, i keep track of my threads in a vector and throw out used ones when they're done. when each thread will be running for at least ten minutes of 100% cpu work i don't care about whatever that overhead might be. put results in a queue. queues are so great for inter-thread communication, go hog wild with queues and pretend you're doing an erlang and ya who cares if something is SO SLOOW ONO IT TAKES A MILLISEOND when you do it less than 10 times a second. thread pools are for stuff like I/O callbacks where starting a thread is a significant cost compared to the work ur doing
|
# ? Sep 4, 2013 02:18 |
|
Mido posted:either use a premade thread safe fifo queue class thing or use mutexes smartly java provides java.util.concurrent.BlockingQueue and several implementations
|
# ? Sep 4, 2013 02:20 |
|
Bloody posted:c thread s: implemented some simple boost::threading in my thing. compiles but needs testing. gently caress thread pools, i keep track of my threads in a vector and throw out used ones when they're done. when each thread will be running for at least ten minutes of 100% cpu work i don't care about whatever that overhead might be. Use futures
|
# ? Sep 4, 2013 02:23 |
|
futures are dumb use promises
|
# ? Sep 4, 2013 02:26 |
|
Nomnom Cookie posted:futures are dumb use promises one of the rare blatantly wrong and uninformed posts in the pos
|
# ? Sep 4, 2013 02:29 |
|
In c++ futures and promises are just a distinction between the producer and the consumer of a value. Promises are one of the ways that you can write to a future
|
# ? Sep 4, 2013 02:33 |
|
Bloody posted:also the boost lib that apt-get installed is a fair bit older than the current release so now i am yak shaving to install the latest release boost releases every five seconds, I don't know what you were expecting
|
# ? Sep 4, 2013 02:34 |
|
FamDav posted:one of the rare blatantly wrong and uninformed posts in the pos im studying for my Shaggar Certified Post Architect exam
|
# ? Sep 4, 2013 02:36 |
|
those who don't understand threadpools are condemned to reinvent them, poorly
|
# ? Sep 4, 2013 02:45 |
|
Thread pools are just horrendous boiler plate above a decent message passing system. Just look what Microsoft did with the API launched in Vista: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686766(v=vs.85).aspx I cannot believe anyone uses any of that. I already noted the timer API is actually broken when using NTP.
|
# ? Sep 4, 2013 02:53 |
|
MrMoo posted:http://msdn.microsoft.com/en-us/library/windows/desktop/ms686766(v=vs.85).aspx those who don't understand threadpools are condemned to reinvent them, poorly
|
# ? Sep 4, 2013 03:05 |
|
MrMoo posted:Thread pools are just horrendous boiler plate above a decent message passing system. Just look what Microsoft did with the API launched in Vista: u mean timers firing incorrectly? what if you specify duration rather than a due time. thats really lol if they gently caress up durations but what can the system do when wall clock time changes, other than roll with the punches
|
# ? Sep 4, 2013 03:07 |
|
Thread pools are also an anachronism to the cloud, I can't recall a single implementation that allows you to scale out across the network.
|
# ? Sep 4, 2013 03:09 |
|
C++ code:
|
# ? Sep 4, 2013 03:13 |
|
Nomnom Cookie posted:u mean timers firing incorrectly? what if you specify duration rather than a due time. thats really lol if they gently caress up durations but what can the system do when wall clock time changes, other than roll with the punches Almost any timer mechanism: code:
code:
|
# ? Sep 4, 2013 03:19 |
|
|
# ? Jun 1, 2024 06:34 |
|
i don't disagree the message passing is for cool people. but if you doing embarrassing parallel things on one machine you shouldn't be making artisanal bespoke threads if you have an alternative.
|
# ? Sep 4, 2013 03:24 |