Performance and quantity of classes

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Performance and quantity of classes

Post by AlexYeCu »

Strange situation.
Writing a game using love2d and 3dreamengine.
90+ fps.
Adding a simple class (no drawing, no update inside, inheritanced from other simple class) — 25 fps…
Removing any string like cClass = require class gives higher fps again.
Looks like there is some limit.
The only suspicious thing — plus pare percents of CPU usage (96 to 98 —100, last drop?).
Memory is ok, video-memory is ok too.
The question. Does anyone know something about the situation?
Is there any known ways for optimizing this?
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Performance and quantity of classes

Post by AlexYeCu »

One class and 4 classes inherited from it: 25 fps. One big class, sum of all 5 — 60 with vsync.
MrFariator
Party member
Posts: 559
Joined: Wed Oct 05, 2016 11:53 am

Re: Performance and quantity of classes

Post by MrFariator »

Can you share example code or .love that demonstrates the framedrops?
Going off of this information alone doesn't give much to work with, I'm afraid.
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Performance and quantity of classes

Post by AlexYeCu »

>Can you share example code

Well, 1.5 Mb of my code, 3 Mb of third party libs, 125 Mb total.
Can build a light weight demo with the same code structure, but not sure if it'll get the same performance issue. I should think how to do it in better way…
User avatar
Sasha264
Party member
Posts: 131
Joined: Mon Sep 08, 2014 7:57 am

Re: Performance and quantity of classes

Post by Sasha264 »

By the given info I suggest that problem is inside "inheritance" mechanism. Lua does not have embedded one, and there is some different technics to implement that. Can you share code about how you implement inheritance? Maybe it contains some copying, maybe it happens every frame by some mistake. Lua does not care about "classes" only about "tables", so if you add one table that designed to be new class — that is only human interpretation, lua does not know about it.

99% CPU usage is also strange. Modern CPU rarely contains 2 or 1 cores (Is that a case?) But with 4 or more cores it is really hard to effectively keep them busy with love. And that by itself can point to some mistake.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests