amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.1k stars 2.31k forks source link

Performance issues on Ubuntu #715

Open mondonomo opened 1 year ago

mondonomo commented 1 year ago

generate_from_frequencies function is 80-90 times slower on Ubuntu 20 EC instance than on Windows Notebook (with a similar CPU) or Mac M1. Profiling shows that the most time is spent on getting the size of the font object.

491 14.976 0.031 14.976 0.031 {method 'getsize' of 'Font' objects}

I am using Python 3.11 and the master release for all OSs, but the differences are the same with the other versions of Python.

amueller commented 1 year ago

Hey. Sorry for the slow reply. Could you provide code to reproduce the issue? Thanks!

mondonomo commented 1 year ago

Hi Andreas, Thank you for your answer and the great project! I've solved my problem by upgrading to the Pillow master release (I've been using 9.4.0), the drawing with it is 20x faster, so I suppose it is a Pillow issue, not yours.

amueller commented 1 year ago

That's interesting, if you feel it's worth trying to speed it up for older versions, we can give it a try. With the new version, is the bottleneck still at the same place?