Re: Long running process - how to speed up?

2022-02-23 Thread Robert Latest via Python-list
Shaozhong SHI wrote: > Can it be divided into several processes? I'd do it like this: from time import sleep from threading import Thread t = Thread(target=lambda: sleep(1)) t.run() # do your work here t.wait() -- https://mail.python.org/mailman/listinfo/python-list

Re: Long running process - how to speed up?

2022-02-20 Thread Dennis Lee Bieber
On Sun, 20 Feb 2022 18:05:33 +, Shaozhong SHI declaimed the following: >I am trying this approach, > >import multiprocessing as mp > >def my_func(x): > print(x**x) > Not much of a processing load there, especially for your small set of integers. I suspect you are consuming a

Re: Long running process - how to speed up?

2022-02-20 Thread Avi Gross via Python-list
Wichmann Cc: python-list@python.org Sent: Sun, Feb 20, 2022 1:05 pm Subject: Re: Long running process - how to speed up? On Sat, 19 Feb 2022 at 19:44, Mats Wichmann wrote: > On 2/19/22 05:09, Shaozhong SHI wrote: > > Can it be divided into several processes? > > Regards, > >

Re: Long running process - how to speed up?

2022-02-20 Thread Chris Angelico
On Mon, 21 Feb 2022 at 05:07, Shaozhong SHI wrote: > However, I have no idea whether this approach will be faster than > conventional approach. > > Any one has idea? Try it. Find out. The only way to know is to measure. I can't see the sleep call though. You may need to post your actual code

Re: Re: Long running process - how to speed up?

2022-02-20 Thread Shaozhong SHI
On Sat, 19 Feb 2022 at 18:51, Alan Gauld wrote: > On 19/02/2022 11:28, Shaozhong SHI wrote: > > > I have a cvs file of 932956 row > > That's not a lot in modern computing terms. > > > and have to have time.sleep in a Python > > script. > > Why? Is it a requirement by your customer? Your manager?

Re: Long running process - how to speed up?

2022-02-20 Thread Shaozhong SHI
On Sat, 19 Feb 2022 at 19:44, Mats Wichmann wrote: > On 2/19/22 05:09, Shaozhong SHI wrote: > > Can it be divided into several processes? > > Regards, > > David > > The answer is: "maybe". Multiprocessing doesn't happen for free, you > have to figure out how to divide the task up, requiring

Re: Long running process - how to speed up?

2022-02-19 Thread Avi Gross via Python-list
sleeping at the same time may be worse! I note badly defined questions get horrible answers. Mine included. -Original Message- From: Alan Gauld To: python-list@python.org Sent: Sat, Feb 19, 2022 7:33 am Subject: Fwd: Re: Long running process - how to speed up? On 19/02/2022 11:28, Shaozhong

Re: Long running process - how to speed up?

2022-02-19 Thread Mats Wichmann
On 2/19/22 05:09, Shaozhong SHI wrote: > Can it be divided into several processes? > Regards, > David The answer is: "maybe". Multiprocessing doesn't happen for free, you have to figure out how to divide the task up, requiring thought and effort. We can't guess to what extent the problem you

Re: Long running process - how to speed up?

2022-02-19 Thread Dennis Lee Bieber
On Sat, 19 Feb 2022 11:28:31 +, Shaozhong SHI declaimed the following: >I have a cvs file of 932956 row and have to have time.sleep in a Python >script. It takes a long time to process. > I'd echo the others... Unless you better explain WHY you have .sleep() (along with how often it

Fwd: Re: Long running process - how to speed up?

2022-02-19 Thread Alan Gauld
On 19/02/2022 11:28, Shaozhong SHI wrote: > I have a cvs file of 932956 row That's not a lot in modern computing terms. > and have to have time.sleep in a Python > script. Why? Is it a requirement by your customer? Your manager? time.sleep() is not usually helpful if you want to do things

Re: Long running process - how to speed up?

2022-02-19 Thread Dan Stromberg
On Sat, Feb 19, 2022 at 3:29 AM Shaozhong SHI wrote: > I have a cvs file of 932956 row and have to have time.sleep in a Python > script. It takes a long time to process. > > How can I speed up the processing? Can I do multi-processing? > How are you doing it right now? Are you using the csv

Re: Long running process - how to speed up?

2022-02-19 Thread Kirill Ratkin
Hi, How I understand your script starts another script and should wait until second one completes its job. Right? If so you have several options depend on how your first script is written. If your script is async then ... there is good asyncio option proc = await

Re: Long running process - how to speed up?

2022-02-19 Thread Shaozhong SHI
Can it be divided into several processes? Regards, David On Saturday, 19 February 2022, Chris Angelico wrote: > On Sat, 19 Feb 2022 at 22:59, Karsten Hilbert > wrote: > > > > > > I have a cvs file of 932956 row and have to have time.sleep in a > Python > > > > script. It takes a long time to

Re: Long running process - how to speed up?

2022-02-19 Thread Albert-Jan Roskam
On Feb 19, 2022 12:28, Shaozhong SHI wrote: I have a cvs file of 932956 row and have to have time.sleep in a Python script.  It takes a long time to process. How can I speed up the processing?  Can I do multi-processing? Perhaps a dask df: 

Re: Re: Long running process - how to speed up?

2022-02-19 Thread Chris Angelico
On Sat, 19 Feb 2022 at 22:59, Karsten Hilbert wrote: > > > > I have a cvs file of 932956 row and have to have time.sleep in a Python > > > script. It takes a long time to process. > > > > > > How can I speed up the processing? Can I do multi-processing? > > > > > Remove the time.sleep()? > >

Aw: Re: Long running process - how to speed up?

2022-02-19 Thread Karsten Hilbert
> > I have a cvs file of 932956 row and have to have time.sleep in a Python > > script. It takes a long time to process. > > > > How can I speed up the processing? Can I do multi-processing? > > > Remove the time.sleep()? He's attesting to only having "time.sleep" in there... I doubt removing

Re: Long running process - how to speed up?

2022-02-19 Thread Chris Angelico
On Sat, 19 Feb 2022 at 22:30, Shaozhong SHI wrote: > > I have a cvs file of 932956 row and have to have time.sleep in a Python > script. It takes a long time to process. > > How can I speed up the processing? Can I do multi-processing? > Remove the time.sleep()? ChrisA --

Long running process - how to speed up?

2022-02-19 Thread Shaozhong SHI
I have a cvs file of 932956 row and have to have time.sleep in a Python script. It takes a long time to process. How can I speed up the processing? Can I do multi-processing? Regards, David -- https://mail.python.org/mailman/listinfo/python-list