Indeed, luajit did not exist at the time. Might have some more info here too
There are some gains to be had with better datastructures https://code.wildfiregames.com/D1739 and more threading => https://gitea.wildfiregames.com/0ad/0ad/issues/5874
There are about 100k loc of JS and rewriting them would be a huge undertaking (Source I tried)
But there is no silver bullet the reason js is slow is that there is a lot of computations happening at the same time, iirc gathering and the attack logic were the worst offenders.
You can probably find some recent js profiling in gitea. And you can run the game under perf to see hotpath, IIRC one of the thing we spend the most time is rbtree_increment which is just a std::map code. There is also the ISQRT function, which performs fixed point square root computations. (That can't be replaced easily, else the game will quickly go out of sync on many platforms)
EDIT: One of the big advantages I see about JS is that a lot of people know it. Whereas lua is a niche language unless you're a gamedev. There are many JS crash courses. Lua not so much.