[fpc-pascal] Really Strange Speed Problems - FPC & Neural Networks

Joao Schuler jp at schulers.com
Wed Apr 17 10:01:28 CEST 2019

For the past 10 days, I've seen really strange speed problems at my end.

In 2 Ubuntu virtualbox VMs (16.04 and 18.04), my neural networks are
running at half speed than usual. The host is a WIN 10 computer. Neural
networks are both CPU and memory bound. Therefore, there is something
affecting either CPU or memory.

Testing on Google Cloud, the speed is normal. This made me think that the
speed problem was local to the testing environment. Just for peace of mind,
I sent a string concatenation algorithm implemented in FPC to a friend to
measure speed. To my shock, the same speed problem I was experiencing at my
end is also happening at his end. This makes me believe that my problem
isn't isolated.

Trying to find why things are slower at my end, I reverted my code to the
code I had 4 months ago and also reverted the compiler to the same version
I was using before (Stable 3.0.4). There was no luck.

Therefore, something really strange is going on:

   - It's not a compilation problem. I moved binaries from an environment
   that doesn't have the speed problem to an environment that has the speed
   problem and I can verify the problem even with a binary built from a good
   - So far, it affects Ubuntu 16.04 and 18.04 (I haven't tested in other
   distros). WIN10 is good.
   - A binary that works well on Google Cloud is slow with my own
   virtualbox VMs 16.04 and 18.04.
   - It also affects at least 1 notebook with Ubuntu 16.04 installed as
   host OS.
   - My CPU reports: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
   - String concatenation is also affected making me to suspect about
   something wrong at malloc/libc.
   - Numerical results from neural networks are correct. So far, it's a
   speed problem.

My question to you is: if anyone from you suspects that something might be
wrong at OS level affecting either your CPU speed or malloc/libc/memory at
your end that might be related to what I'm seeing here, please share. I
have algorithms running at my end from a quarter to half of the original
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190417/6be80851/attachment.html>

More information about the fpc-pascal mailing list