Hi Carl, Thank you for informing about the issue link, I’ll be following that. Yes, "writelines" took much more longer time in that case I suppose but I would expect them to be same but it’s good to know that with few tweaks it can actually got faster. I’ll take a look more on other things made the CLI slower and if I find something interesting, I’ll let you know for sure! Best, Emre Yavuz
On 2 May 2021, at 16:06, Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> wrote:
Ah, I found one problem: your script uses .writelines with a string as the argument. writelines usually takes an iterator (like a list) but it will also work with a string argument, and then do:
for char in s: w.write(char)
if I replace the writelines(...) with a .write(...) it becomes much faster, both on cpython and pypy.
CF
On 5/2/21 12:49 AM, Emre Yavuz wrote:
Hi Carl,
Sorry I couldn’t receive your message (probably something wrong in my mail configuration) but I saw the message from digest.
I created self contained program for this example. I am using “writelines”
*That’s paste bin link to program:* https://pastebin.com/D6auMcwN <https://pastebin.com/D6auMcwN>
*Command line:* (devpy) emreyavuz:tmp emreyavuz$ python3 test-writer Time has been spend for copying data 28 secs (devpy) emreyavuz:tmp emreyavuz$ pypy3 test-writer Time has been spend for copying data 118 secs
Best, Emre Yavuz