Skip to main content

All Questions

0 votes
1 answer
1k views

Why is async file writing slower than sync file writing?

I am currently trying to understand how asyncio works in Python. I want to speed up file writing using asynchronous file writing in the aiofiles library. I have a synchronous writing function: def ...
Dima Bukharev's user avatar
0 votes
1 answer
2k views

Why is reading a file asynchronously (with aiofile) so much (15x) slower than its synchronous equivalent?

I'm experimenting mit named pipes and async approaches and was a bit surprised, how slow reading the file I've created seems to be. And as this question suggests, this effect is not limited to named ...
frans's user avatar
  • 9,858
3 votes
1 answer
1k views

Async file copy - why is the file descriptor bad?

Would like to implement Python code to read and write (i.e. copy) a file. The goal is to read and write concurrently, so it reduces the time to execute the file copy. This is a learning exercise for ...
Kosa's user avatar
  • 77
5 votes
1 answer
2k views

async version runs slower than the non async version

My program does the following: Takes folder of .txt files For each file: 2.1. read the file 2.2 sort the contents as a list and pushes the list to a master list I did this without any async/await ...
rrgirish's user avatar
  • 331
0 votes
1 answer
1k views

Parsing large number of HTML files with asyncio aiofiles and parsing them in pandas DataFrame

I have around 40 000 HTML files on disk and function that parses HTML with Beautiful Soup and returns dictionary for each HTML. During reading/parsing I'm appending all dictionaries to list and ...
Hrvoje's user avatar
  • 15.3k
-1 votes
2 answers
983 views

How to convert lots of HTML to JSON with asyncio in Python

This is my first attempt at using asyncio in python. Objective is to convert 40000+ htmls to jsons. Using a synchronous for loop takes about 3.5 minutes. I am interested to see the performance boost ...
Imrul Huda's user avatar
3 votes
1 answer
1k views

Why is reading and calling an API from a file slower using Python async than synchronously?

I have a large file, with a JSON record on each line. I'm writing a script to upload a subset of these records to CouchDB via the API, and experimenting with different approaches to see what works the ...
James Kelleher's user avatar
15 votes
1 answer
51k views

Writing files asynchronously

I've been trying to create a server-process that receives an input file path and an output path from client processes asynchronously. The server does some database-reliant transformations, but for the ...
Eli Korvigo's user avatar
  • 10.5k