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
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
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,
> >
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
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?
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
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
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
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
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
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
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
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
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:
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()?
>
>
> > 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
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
--
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
18 matches
Mail list logo