Gnumeric slow to add/delete rows

I have a large spreadsheet that contains all of the ornamental plants that go into our garden. I started it in 2021, but I’ve noticed that it’s becoming slower and slower and is now almost unusable if I insert/delete a row. Like, time to get a cup of coffee and walk the dog while it runs unusable.

I thought it might have been all of my conditional formatting, but tonight I removed it all and I’m still having problems (although the speed isn’t nearly as bad as before).

I saved the spreadsheet as a .xlsx file and imported it into Google Sheets, but any changes are instantaneous there. libreoffice was also instantaneous after I loaded a .xls file there.

I’m running 1.12.56 on Fedora 39 with X. My desktop has a beefy CPU and plenty of RAM. The process uses about 370MB of RAM, but the CPU usage jumps to 100% while the insert is ‘pending.’

I ran strace against it and inserted near the bottom (changes there are faster than at the top) and I see this:

165978 00:17:16.629800 writev(3, [{iov_base="+*\1\0+4\1\0", iov_len=8}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 8
165978 00:17:16.629815 poll([{fd=3, events=0x1}], 1, -1) = 1 ([{fd=3, revents=0x1}])
165978 00:17:16.629916 recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\2X$\0\0\0\0\10\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 304 
165978 00:17:16.630043 recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) 
165978 00:17:16.630146 recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) 
165978 00:17:16.630168 recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) 
165978 00:17:16.630188 recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) 
165982 00:17:23.740587 <... poll resumed>) = 0 (Timeout) 
165982 00:17:23.740688 poll([{fd=9, events=0x1}], 1, -1 <unfinished ...>

It seems like it’s sitting and waiting for more input on file descriptor 3, eventually times out, and and then proceeds.
(but I might also be way off-base).

During the time that I’m waiting for inserts to complete gnumeric is totally unavailable. If I switch virtual desktops and come back there is nothing on the screen except for a black window. I set calculation to ‘manual,’ but that didn’t seem to help either. When I do click on recalculate it only takes one or two seconds too.

[adding more information]
I installed the debuginfo version of gnumeric and ran it under gdb. When it became stuck I looked at the threads:

(gdb) info threads
Id Target Id Frame

  • 1 Thread 0x7ffff512db80 (LWP 206652) “gnumeric” 0x00007ffff6c8ac9b in __GI___libc_malloc (bytes=bytes@entry=16) at malloc.c:3294
    2 Thread 0x7fffe78006c0 (LWP 206655) “pool-spawner” syscall ()
    at …/sysdeps/unix/sysv/linux/x86_64/syscall.S:38
    3 Thread 0x7fffe6e006c0 (LWP 206656) “gmain” 0x00007ffff6cf3e3d in __GI___poll (fds=0x55555561b7e0, nfds=2, timeout=-1)
    at …/sysdeps/unix/sysv/linux/poll.c:29
    4 Thread 0x7fffe64006c0 (LWP 206657) “gdbus” 0x00007ffff6cf3e3d in __GI___poll (fds=0x7fffd4000b90, nfds=3, timeout=-1)
    at …/sysdeps/unix/sysv/linux/poll.c:29
    5 Thread 0x7fffe5a006c0 (LWP 206658) “dconf worker” 0x00007ffff6cf3e3d in __GI___poll (fds=0x7fffcc000b90, nfds=1, timeout=-1)
    at …/sysdeps/unix/sysv/linux/poll.c:29

It appears that it’s stuck trying to allocate 16 bytes of memory via malloc(), despite having 50+GB available on the system.

Next I ran it under perf, which says it was spending 20.72% of its time trying to do a malloc:

  20.72%  gnumeric        libc.so.6                       [.] _int_malloc
  15.94%  gnumeric        libspreadsheet-1.12.56.so       [.] cell_dep_changed
  13.52%  gnumeric        libc.so.6                       [.] _int_free
   8.53%  gnumeric        libspreadsheet-1.12.56.so       [.] cell_foreach_dep

Do you have any tips to better debug what’s going on? Or an ‘Oh, I’ve seen this and all you do is [foo]’? (doubtful, but…)

Thanks for any pointers!

Chris