HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Could module abuse adversely affect map file size?

04-15-2009, 06:28 PM#1
Anitarf
Modules bring the potential for huge code bloat. While they were originally intended for things that you would have to write for every struct anyway, it seems like they might be used to inline whole systems into spells by speed enthusiasts (since regular function calls are faster than interface method evaluates). So, how much does vJass code contribute to a map's filesize and could modules drastically affect this?
04-15-2009, 08:36 PM#2
Bobo_The_Kodo
The map size change is insignificant
04-15-2009, 08:41 PM#3
fX_
um what's a module
04-15-2009, 09:14 PM#4
akolyt0r
Quote:
Originally Posted by fX_
um what's a module
use search...
04-15-2009, 09:33 PM#5
darkwulfv
I can see why you'd think that, but as said the filesize change would probably be, at most, like... <100 kb? And that's probably pushing it. I don't know, but unless it's SERIOUS abuse, I don't think it'd be something to wet the bed over.
04-15-2009, 09:50 PM#6
busterkomo
100kb is quite significant for maps without any imported material. I mean, if I made I map that was only 50kb, it'd be quite a hindrance to players if I increased it by 100kb, right?
04-15-2009, 09:58 PM#7
darkwulfv
Hardly. Even on a 56kb/s connection, that's like... A few more seconds? And that was an extreme case I was talking about.
04-15-2009, 11:02 PM#8
Rising_Dusk
Consider how small an impact on filesize that reimporting common.j has on a map. I really don't think modules will be a problem, although I find inlining entire systems a bit eccentric.
04-16-2009, 10:23 PM#9
Vexorian
Of course they can, but basically it is not a danger that was not introduced already with other features like textmacros.

In fact, I can already see it coming:
Collapse JASS:
globals
    constant integer MAX_HANDLES = 400000
endglobals

//omgz module allows attaching structs to handlez
module omgzAttachModule
     private static thistype array OMGZ[MAX_HANDLES]

     method operator [] takes handle h returns thistype
             return .OMGZ[ H2I(u)- 0x100000]
     endmethod

     method operator []= takes handle h, thistype x returns nothing
             set .OMGZ[ H2I(u)- 0x100000] = x
     endmethod

endmodule


struct userA
    implement omgzAttachModule
endstruct
struct userB
    implement omgzAttachModule
endstruct
struct userC
    implement omgzAttachModule
endstruct
struct userD
    implement omgzAttachModule
endstruct

Try compiling THAT.

Quote:
I find inlining entire systems a bit eccentric.
Modules are meant to do the exact opposite.