flamewing / asl-releases

Improved/bugfixed version of Alfred Arnold's The Macro Assembler AS
http://john.ccac.rwth-aachen.de:8000/as/
GNU General Public License v2.0
20 stars 2 forks source link

AS is really slow #6

Open Awuwunya opened 3 years ago

Awuwunya commented 3 years ago

Enough said. It's pretty inefficient and apparently the code is really bad. Whatever the case is, even with a decent computer and a SSD, assembling some games can initially take > 30 seconds, and even after being cached it takes several seconds. ASM68K can usually get the same job done in 100-300ms. Although since AS is multipass, I'd understand it taking more time, but I think it could be improved a lot. It may be a large undertaking to do so, but at least some optimizations could go a long way to making it better to use.

flamewing commented 3 years ago

Personally, I found that always specifying instruction attributes and restricting AS to only two passes yields times < 6 seconds. Improving speed would require an almost complete rewrite, since the slowness is structural; there is a large amount of inefficiencies throughout the code. But I can try running through a profiler to see if I can speed it up a bit.

flamewing commented 3 years ago

It seems that there is about a 20% speedup from enabling link-time optimization. There is also an about 80% speedup by using AS under Linux instead of Windows -- and that is running Linux in WSL2, instead of pure Linux.

I still need to see about that profiler (I will probably fix the other issues first), but it is funny to see that a huge performance problem in AS is... Windows 🤣

flamewing commented 3 years ago

I have done some profiling; and it seems that about half the time spent by AS is in memcmp/strcmp. This means that swapping from its binary tree symbol table to a hash table is likely to give a large performance boost. I will investigate some more, and make the swap for testing.