Is having ALOT of code a problem?

Hello,

I have not simplified a lot of my code. If I think about the ending number of lines of code is approximately 700,000 lines of code. Does this do anything to my project? Will it hurt it at all? What are the effects.

Thank you. [import]uid: 23689 topic_id: 18714 reply_id: 318714[/import]

must be on hell of a game.

wouldn’t worry if the game plays and performs to your expectations.;

c. [import]uid: 24 topic_id: 18714 reply_id: 71919[/import]

wow, 700k lines is insane! how does one not get lost in it? [import]uid: 16142 topic_id: 18714 reply_id: 71920[/import]

That is a lot of code for sure, maintainability can get problematic in the near future especially if you are working on more than one project at a time.

If I were you I’d spend some time optimizing the size of the code, that will save many headaches later.

Raúl Beltrán [import]uid: 44101 topic_id: 18714 reply_id: 71937[/import]

Try using this code snippet,

Runtime:addEventListener(“memoryWarning”, listenerFunction )

local function handleLowMemory( event )
print( “memory warning received!” )
end

You can then monitor texture memory used by calling display.getInfo(“textureMemoryUsed” )

Please let us know what the results are ?
The above code was pulled from the Corona API documentation.

[import]uid: 11094 topic_id: 18714 reply_id: 71944[/import]

Hey, @me7, I didn’t quite understand what you meant when you wrote: “still, it would surprise me if the number of MB of machine or Lua byte code in memory on deployment is > 4x the number of lines.”

Do you mean that the number of lines affect the number of MB of machine/lua byte code in memory? And does that mean that writing more lines of code translates to larger size for the app?

Maybe I got it all wrong… but if more lines of code means larger file size at the end of the day, I imagine we’d all want to keep the number of lines to be less…

Naomi [import]uid: 67217 topic_id: 18714 reply_id: 71978[/import]

It’s a very loose approximation I made in my head.

Yes, the app inevitably gets larger as the amount of lines gets larger. (Assuming those lines contain code that does something and aren’t comments/blank.)

However, you usually have to write an absurd amount of code for it to noticeably impact total size. For PC games, it’s not a concern whatsoever (except when cache optimizing), for mobile phones it shouldn’t be a concern in 99.99% of the cases.

I can’t give a more exact approximation because I don’t know how the Lua code is translated on Android (to Java, native or just interpreted Lua bytecode), nor iOS. So I made my estimate assuming each line of code contains one assignment statement on average, and produces 4 bytes in the output memory, which is an extremely rough approximation.

I think an Ansca employee who wrote the compile system would have a much a better idea of how to set approximate limits.

So basically, don’t worry about it at all unless you for some reason will have several hundreds of thousands of LOC like the OP. It’s a fair question for him, although bets are he doesn’t have to worry either. [import]uid: 58849 topic_id: 18714 reply_id: 71979[/import]

For a framework like corona that is really high. For a standard iPhone/Android app that is probably on the low side.

Is there any impact on having that much code? Probably, but not enough to really notice. [import]uid: 46343 topic_id: 18714 reply_id: 71983[/import]

How did/will you arrive at 700k anyway? :slight_smile: Some auto gen code or just a lot of man hours? I automatically generated 10k for my AI using genetic programming, and I didn’t need to write an app above 10k handwritten yet.

Normally, code size is not a problem, even for mobile phones (which are still very powerful compared to more limited embedded systems). But I’m not sure exactly what Corona compiles to - still, it would surprise me if the number of bytes of machine or Lua byte code in memory on deployment is > 4x the number of lines.

Edited from MB to bytes, don’t forget your units. :wink: [import]uid: 58849 topic_id: 18714 reply_id: 71968[/import]

700k on the low side? That’s several man years.

For a top of the line game maybe. I would expect to be able to do a small but not trivial game in <50k on regular Android. [import]uid: 58849 topic_id: 18714 reply_id: 71985[/import]

o_0 700k lines of code? is Windows XP in written LUA comming to App Store?!? [import]uid: 12704 topic_id: 18714 reply_id: 71994[/import]

I’m factoring in stuff that I probably shouldn’t have, for a game using a library like cocos2d and some other frameworks and stuff 700,000 lines of code isn’t really that hard to achieve.

However for a Lua file that is massive. [import]uid: 46343 topic_id: 18714 reply_id: 72001[/import]

Thanks for your replies. What my concern is mainly will it start lagging or have any problems with more code?

[import]uid: 23689 topic_id: 18714 reply_id: 72094[/import]

There isn’t anything that would cause it to lag after XXX LOC count.

So no it shouldn’t unless it’s bad code. [import]uid: 46343 topic_id: 18714 reply_id: 72099[/import]