lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 10/28/2014 12:15 PM, Coda Highland wrote:
On Mon, Oct 27, 2014 at 9:02 PM, Rena wrote:
I'm using Lua in a homebrew PSP app (not PS Vita, the original PSP
with 32-64MB RAM and ~333mhz MIPS CPU) and finding performance has
dropped rather sharply (compared to original app which didn't use
Lua). It's using Lua 5.2, though compiling another version for it
wouldn't be out of the question. The main loop isn't doing a lot of
work, but makes multiple calls to C functions (read the button states,
draw things on the screen, read the clock). Does anyone have advice to
improve performance?

I pinged a friend of mine who used to do a lot of PSP development. He
recommends making sure you're caching aggressively -- for example,
checking the button state more than once per frame is meaningless.

Myself, I'd suggest seeing if LuaJIT's MIPS port will work, even with
just the interpreter. It might perform better.

Perhaps JIT is the best solution. There is a R4000 reference manual on the internet, it's pretty enlightening.

The R4000 on the PSP is said to have 16KB ICache and 16KB DCache. No level 2 unfortunately. Even worse for modern workloads, both level 1 caches are direct-mapped. An interpreter will churn the caches a lot more.

Also, the FPU mentioned in the manual has significantly higher latencies for some operations versus modern FPUs, e.g. ADD and SUB for floating point have a minimum latency of 4. Bad news for the default Lua number type.

Can't find any detailed processor data for the PSP R4000, but the original R4000 is purportedly a 1991 thing (PSP is 2004). No idea whether Sony made changes, maybe not, so then it will be 1991 technology. It will look pretty weak compared to modern processors...

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia