Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: What about Python 3.11 performance boost
Post: RE: What about Python 3.11 performance boost
General performance boost.
As they say between 10-60%. Depends on what are you doing. |
|
wavic |
News and Discussions |
2 |
1,554 |
Nov-01-2022, 10:45 AM |
|
|
Thread: OCR again
Post: RE: OCR again
Glad to hear that. And I am sorry that didn't mention the import part.
In case you are not familiar with generators in Python take a look at some tutorials on the web. They can save a lot of memory.
... |
|
wavic |
Bar |
22 |
6,355 |
Nov-01-2022, 09:22 AM |
|
|
Thread: What about Python 3.11 performance boost
Post: What about Python 3.11 performance boost
Has anyone tested 3.11's widely announced performance boost?
I am eager to try it but my Arch still offers me 3.10.8-2 |
|
wavic |
News and Discussions |
2 |
1,554 |
Nov-01-2022, 07:54 AM |
|
|
Thread: OCR again
Post: RE: OCR again
It depends on the time needed for an image, memory consumption and the max. number of threads allowed.
You can limit them to a number you want passing max_workers as a parameter.
with concurrent.fut... |
|
wavic |
Bar |
22 |
6,355 |
Oct-31-2022, 07:14 PM |
|
|
Thread: OCR again
Post: RE: OCR again
Alright, I see it that way. Simplified:
def convert_img(img_obj):
return new_img # not written to the disk but in memory
def do_ocr(image_data):
return document
def worker(path):
with... |
|
wavic |
Bar |
22 |
6,355 |
Oct-31-2022, 05:51 PM |
|
|
Thread: Wsgiref with asyncio ?
Post: RE: Wsgiref with asyncio ?
You can print a message for every request and after that you await asyncio.sleep(15) both in maincoro. Run the whole thing and refresh the "web page" two-three times. If you get the message on every r... |
|
wavic |
Networking |
8 |
3,574 |
Oct-31-2022, 03:47 PM |
|
|
Thread: OCR again
Post: RE: OCR again
It costs you nothing to try. One import, one with statement and one method call.
You can try both - ThreadPoolExecutor and ProcessPoolExecutor. Over 100 testing files and measure the time needed to f... |
|
wavic |
Bar |
22 |
6,355 |
Oct-31-2022, 01:44 PM |
|
|
Thread: reading content between a specific xml tag
Post: RE: reading content between a specific xml tag
>>> data = '''<?xml version="1.0" encoding="UTF-8"?>
... <spml:batchresponse designation="software developers">
...
... <response>
...
...
...
... <position alias... |
|
wavic |
General Coding Help |
1 |
1,278 |
Oct-31-2022, 01:37 PM |
|
|
Thread: OCR again
Post: RE: OCR again
For cpu intensive task why not use additional cores?
But since it is reading a lot of files from a disk and the capabilities of nowadays machines I wonder if that is a more IO-bound task instead of a... |
|
wavic |
Bar |
22 |
6,355 |
Oct-31-2022, 08:41 AM |
|
|
Thread: Automate MML Commands
Post: RE: Automate MML Commands
The code should change. The previous one too.
I just showed you how you can loop over the commands and them. The moment I posted my answer though it crossed my mind that you have to connect successfu... |
|
wavic |
General Coding Help |
10 |
3,584 |
Oct-31-2022, 08:15 AM |
|
|
Thread: python multiprocessing to download sql table
Post: RE: python multiprocessing to download sql table
from concurrent.futures import ProcessPoolExecutor
with ProcessPoolExecutor() as executor:
results = executor.map(square, arr) |
|
wavic |
General Coding Help |
5 |
2,377 |
Oct-31-2022, 07:49 AM |
|
|
Thread: Wsgiref with asyncio ?
Post: RE: Wsgiref with asyncio ?
I am not familiar with the plain WSGI at all. Never used directly. So I can only guess how it works.
But first something about asycnio.
run_until_complete returns the result of a future object ( mai... |
|
wavic |
Networking |
8 |
3,574 |
Oct-31-2022, 02:50 AM |
|
|
Thread: multi-threaded tcp server-newbie
Post: RE: multi-threaded tcp server-newbie
You may want to look at that library.
https://zeromq.org/languages/python/ |
|
wavic |
Networking |
15 |
5,867 |
Oct-30-2022, 06:47 AM |
|
|
Thread: Wsgiref with asyncio ?
Post: RE: Wsgiref with asyncio ?
Maybe this could give you some directions.
Note that the syntax for making a coroutine is async def/await now. That one there was the old way. Using a decorator...
You are awaiting instead of yiel... |
|
wavic |
Networking |
8 |
3,574 |
Oct-28-2022, 02:59 PM |
|
|
Thread: Wsgiref with asyncio ?
Post: RE: Wsgiref with asyncio ?
I personally can't.
I found that discussion and it seems if you want to implement some asynchronous behaviour it won't work just using asyncio. That lib is a single-threaded module to make async cal... |
|
wavic |
Networking |
8 |
3,574 |
Oct-28-2022, 11:17 AM |
|
|
Thread: delete all files and subdirectory from a main folder
Post: RE: delete all files and subdirectory from a main ...
If that is a general question, I can't see how it is related to Python.
I see the Windows file system here so we should look at del command.
Anyway, not so familiar with cmd or PowerShell so I did a ... |
|
wavic |
General Coding Help |
7 |
2,506 |
Oct-27-2022, 05:44 PM |
|
|
Thread: Automate MML Commands
Post: RE: Automate MML Commands
Instead of importing concurrent.futures and using ThreadPoolExecutor you just do it in a loop
for command in commands_list:
subproces.run(command)That way you get commands one by one from comman... |
|
wavic |
General Coding Help |
10 |
3,584 |
Oct-27-2022, 02:04 PM |
|
|
Thread: reading in a doc
Post: RE: reading in a doc
Non-printable characters?
You may try print(bytes(motD, 'utf-8')) |
|
wavic |
General Coding Help |
4 |
1,643 |
Oct-27-2022, 01:36 PM |
|
|
Thread: reading in a doc
Post: RE: reading in a doc
Nothing to print?
Try to change it
print(j, motD) |
|
wavic |
General Coding Help |
4 |
1,643 |
Oct-27-2022, 11:17 AM |
|
|
Thread: Automate MML Commands
Post: RE: Automate MML Commands
You can try something like this:
import concurrent.futures
import subprocess
commands = """
# command 1
# command 2
# ...
# command n
"""
# Or! You can get them from a file
# make a list of these c... |
|
wavic |
General Coding Help |
10 |
3,584 |
Oct-27-2022, 10:48 AM |