Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
git apologist
Jun 4, 2003

if a bunch of neckbeards in yospos can't read that parellisation code, you can't understand it, and your poo poo is fast anyway, then just keep it simple. don't implement it. maintainable code is more important than efficient or fast code

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Storysmith posted:

okay so the code assumes you have a 1-dimensional list that has all the pixel values of your av image.
it defines a function that tells you if the image is transparent or not, and then starts a (lightweight thread, i think is the default?) pool of executors that each take a single entry in that list and calculate if that pixel is opaque or transparent, and then the all() (iirc) tells you if any of them are opaque

the use of the map function there is some unintuitive stuff to newcomers — you’re not calling the is_transparent function in that map line. you’re passing the function itself in as an object that then gets called by map() with the proper alpha array entry for each one in the list.

i can never remember what the technical cs term for it is but it’s one of those things that broke my mind when i learned ruby from a codebase full of people who loved map and filter and the like.
rip vine

actually from what i can tell in the docs, it forks 32,400 new python interpreter processes and sends the alpha value of one pixel and the is_transparent function to each process. each process calls is_transparent on the value of the one pixel it was assigned, and passes the result back to the main process. the main process collects all the results and puts them into a sequence called x, and all() tells you if all of them are transparent, or at least one isn’t transparent

so basically what you said but it’s forking a new process for each pixel to maximize parallelization

Sagebrush
Feb 26, 2012

As noted earlier a single threaded version checks the whole avatar in 7 milliseconds so you could have people doing this 12 million times a day on average before you even start to overlap requests, let alone produce noticeable lag.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Sagebrush posted:

As noted earlier a single threaded version checks the whole avatar in 7 milliseconds so you could have people doing this 12 million times a day on average before you even start to overlap requests, let alone produce noticeable lag.

that 7 milliseconds also included constructing the list of values and printing to console too!

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

hbag posted:

i dont think checking the transparency of a pixel at most 32,400 times is very efficient
ill give it a try

computers are very, very, very fast

like if you use an image processing library something like this should be fully vectorized and just fly

what do you want to use this for anyway

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

fart simpson posted:

pro tip: if you use a statically typed compiled language you’ll encounter this more often imo

it’ll just be so much pain to write in the first place that you’ll decide to do something else

op use Lisp not Haskell

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

rotor posted:

hbag, are you familiar with nntp

I love you too

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
see you in September starts playing in the background

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
hbag you should build the forums authenticator and then use it to write an NNTP gateway for the forums on top of papercut

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

hbag posted:

i thought putting loops inside loops was a bad idea
this part of the code is already in a while loop, sticking a for loop in it is gonna be 2 loops

real software is nothing but loops in loops all the way down

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

eschaton posted:

it’ll just be so much pain to write in the first place that you’ll decide to do something else

op use Lisp not Haskell

use both imo

Storysmith
Dec 31, 2006

feeling extremely torn between romanticizing NNTP and the rest of the Old Net as a meeting of the minds unsullied by corporate advertising and venture capital, and the awareness that there was a process for figuring out who those minds got to be and it was mostly people like me and that one of the few benefits of this social media hellscape we live in is the sheer diversity of human experience on display

in conclusion endless september is a land of contrasts

Kazinsal
Dec 13, 2011



fart simpson posted:

actually from what i can tell in the docs, it forks 32,400 new python interpreter processes and sends the alpha value of one pixel and the is_transparent function to each process. each process calls is_transparent on the value of the one pixel it was assigned, and passes the result back to the main process. the main process collects all the results and puts them into a sequence called x, and all() tells you if all of them are transparent, or at least one isn’t transparent

so basically what you said but it’s forking a new process for each pixel to maximize parallelization

this is insane

it takes a single cycle to check if a 32-bit RGBA value is fully opaque or not. it takes several hundred cycles to context switch between one process and another. fully forking processes is also absurdly slow

what the gently caress is wrong with p-lang people

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Kazinsal posted:

this is insane

it takes a single cycle to check if a 32-bit RGBA value is fully opaque or not. it takes several hundred cycles to context switch between one process and another. fully forking processes is also absurdly slow

what the gently caress is wrong with p-lang people

i feel like things might have gone over your head somewhat

hbag
Feb 13, 2021

Gentle Autist posted:

you say this every time you post, lol

that makes sense, im always exhausted

President Beep
Apr 30, 2009





i have to have a car because otherwise i cant drive around the country solving mysteries while being doggedly pursued by federal marshals for a crime i did not commit (9/11)

Jonny 290 posted:

this poo poo is why i gave up trying to learn Coding. what the gently caress is this

jonny this post makes me feel validated. bless you.

Zlodo
Nov 25, 2006

Jonny 290 posted:

this poo poo is why i gave up trying to learn Coding. what the gently caress is this

you just describe a computation that you want to apply to a bunch of things and let the computer split up the work across a bunch of threads

I mean that code looks like crap but it's because my monitor is off it's written in python

President Beep
Apr 30, 2009





i have to have a car because otherwise i cant drive around the country solving mysteries while being doggedly pursued by federal marshals for a crime i did not commit (9/11)
for me the concept is easy enough. it’s the loving syntax that frustrates me.

President Beep
Apr 30, 2009





i have to have a car because otherwise i cant drive around the country solving mysteries while being doggedly pursued by federal marshals for a crime i did not commit (9/11)
it probably doesn’t help that I didn’t start touching computers for a living until i was 40 (last year lol)

Khorne
May 1, 2002

Gentle Autist posted:

if a bunch of neckbeards in yospos can't read that parellisation code, you can't understand it, and your poo poo is fast anyway, then just keep it simple. don't implement it. maintainable code is more important than efficient or fast code
if you ignore all the stuff that doesn't matter the code is:

worker_pool.map(function, collection)


which requires the person to be familiar with map

Khorne fucked around with this message at 14:36 on Jun 3, 2021

Bloody
Mar 3, 2013

it's important to also note that it is such a nonsense application of parallelization as to inherently not make sense

Bloody
Mar 3, 2013

Bloody posted:

it's important to also note that it is such a nonsense application of parallelization as to inherently not make sense

mlyp

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


Guido: now who's sorry, now who's the loving rear end in a top hat?

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

amazing that the fake venezuelan president is also the guy who unleashed python on the world. what a piece of work

AnimeIsTrash
Jun 30, 2018

Gentle Autist posted:

if a bunch of neckbeards in yospos can't read that parellisation code, you can't understand it, and your poo poo is fast anyway, then just keep it simple. don't implement it. maintainable code is more important than efficient or fast code

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

just loving loop it lmao

Cybernetic Vermin
Apr 18, 2005

really i think the next split for the hbag speedrun of being a computer nerd in 2003, the one right after making a forums sig image service, is getting addicted to wow and doing nothing else for 5 years.

e: apparently the new 100% category bypasses the mirc scripts.

Cybernetic Vermin fucked around with this message at 18:03 on Jun 3, 2021

Share Bear
Apr 27, 2004

multiprocessing is really bootleg but it also whips rear end when you need it, love that library

logging from it is weird though and requires actually understanding what's going on under the hood https://docs.python.org/dev/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes

hbag
Feb 13, 2021

eh i got it working
check it out

Eeyo
Aug 29, 2004

hbag posted:

eh i got it working
check it out



nice

Fuzzy Mammal
Aug 15, 2001

Lipstick Apathy


rookie numbers

e: make it animate :mrgw:

hbag
Feb 13, 2021

Fuzzy Mammal posted:



rookie numbers

e: make it animate :mrgw:

blegh later

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
fyi if you're trying for sophisticated effects you may want to look at svg. Its a lot more flexible for this kind of thing than just rasters and you can always render it to a png at the end if you want to

Archduke Frantz Fanon
Sep 7, 2004



you should render the probation frame around the avatar that'd be cool

hbag
Feb 13, 2021

rotor posted:

fyi if you're trying for sophisticated effects you may want to look at svg. Its a lot more flexible for this kind of thing than just rasters and you can always render it to a png at the end if you want to

honestly i barely even know what an svg is

hbag
Feb 13, 2021

Archduke Frantz Fanon posted:



you should render the probation frame around the avatar that'd be cool

eventually, once ive got all this poo poo running how i want

hbag
Feb 13, 2021

transparency masking for gifs is being fucky
for example:

Eeyo
Aug 29, 2004

rotor posted:

fyi if you're trying for sophisticated effects you may want to look at svg. Its a lot more flexible for this kind of thing than just rasters and you can always render it to a png at the end if you want to

didn't know you could include images into svgs, i'll have to keep that in mind next time i gently caress around with them

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

hbag posted:

honestly i barely even know what an svg is

its a vector graphics file format. The nice thing is its css-sensitive and has effects like blur and zoom and animations and so forth that you can author in a text file instead of pixel-by-pixel

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Eeyo posted:

didn't know you could include images into svgs, i'll have to keep that in mind next time i gently caress around with them

svg is in fact very good

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply