Recent

Author Topic: list of units without SysUtils/Classes uses  (Read 11392 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8896
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #15 on: June 22, 2016, 09:44:15 am »
No, I don't see an easy way except writing your own tool on top of fcl-passrc or so, and find a solution for conditional code in the USES.

Keeping your own sets of units is probably your only option, since which units that may use sysutils and/or classes might change over time.

Since 2.0 -2.2 sysutils is the main "file and directory + name manipulation" unit, taking the flag from unit dos it is pretty ubiquitous, even in pretty much old procedural code.

You might want to read http://wiki.freepascal.org/Size_Matters
« Last Edit: June 22, 2016, 09:46:23 am by marcov »

Awkward

  • Jr. Member
  • **
  • Posts: 68
Re: list of units without SysUtils/Classes uses
« Reply #16 on: June 22, 2016, 10:03:06 am »
You might want to read http://wiki.freepascal.org/Size_Matters
Trust me, i read and not once ^_^
well, i think, i must wait time when FPC will get ability to build something like delphi bpl packages or continue to keep my line (and search all needed info manually)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8896
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #17 on: June 22, 2016, 10:16:03 am »
Delphi package support is being worked on in trunk.

Thaddy

  • Hero Member
  • *****
  • Posts: 10573
Re: list of units without SysUtils/Classes uses
« Reply #18 on: June 22, 2016, 01:16:09 pm »
Use KOL. Solved. ;) Has Base64 streams, doesn't use classes or sysutils. Really small exes. Not portable, only on windows flavors.

Cyrax

  • Hero Member
  • *****
  • Posts: 838
Re: list of units without SysUtils/Classes uses
« Reply #19 on: June 22, 2016, 01:38:00 pm »
You might want to read http://wiki.freepascal.org/Size_Matters
Trust me, i read and not once ^_^
well, i think, i must wait time when FPC will get ability to build something like delphi bpl packages or continue to keep my line (and search all needed info manually)

With dynamic packages, you still need to distribute the RTL and (probably) other packages. It wont magically squeeze your program to minimal size...

rvk

  • Hero Member
  • *****
  • Posts: 4390
Re: list of units without SysUtils/Classes uses
« Reply #20 on: June 22, 2016, 01:40:40 pm »
Use KOL. Solved. ;) Has Base64 streams, doesn't use classes or sysutils. Really small exes. Not portable, only on windows flavors.
Already said and answered.

Are you looking for something like KOL?
http://wiki.freepascal.org/KOL-CE
http://kolmck.net/
i tried KOL but don't like some things there. maybe some chaos in sources and some troubles to use it with delphi 5 and fpc? 32 and 64 bit  compilation at same time. and it still not compatible with linux  (not wine).

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8896
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #21 on: June 22, 2016, 03:14:03 pm »
With dynamic packages, you still need to distribute the RTL and (probably) other packages. It wont magically squeeze your program to minimal size...

Yes, only helps when distributing multiple ones. And that is assuming that for the small programs the overhead of dynamic packaging is smaller than the room saved. (since the mainprogram must have a list of symbols to import etc)

But size discussions are rarely rational anyway, so it doesn't matter. 

I agree with Thaddy, just direct all minimalists to KOL and let them deal with it :-)

BeniBela

  • Hero Member
  • *****
  • Posts: 763
    • homepage
Re: list of units without SysUtils/Classes uses
« Reply #22 on: June 22, 2016, 03:35:15 pm »

But size discussions are rarely rational anyway, so it doesn't matter. 


You can make them rational with nm

Code: [Select]
$ nm -a --print-size --size-sort -t d project1 | grep CLASSES | awk '{ sum+=$2} END {print sum}'
174667

$ nm -a --print-size --size-sort -t d project1 | grep SYSUTILS | awk '{ sum+=$2} END {print sum}'
167199

$ nm -a --print-size --size-sort -t d project1  | tail -n 30
0000000004473088 0000000000001277 T CLASSES$_$TREADER_$__$$_READROOTCOMPONENT$TCOMPONENT$$TCOMPONENT
0000000004240048 0000000000001301 T fpc_ansistr_concat_multi
0000000004340112 0000000000001495 T LNFODWRF_$$_PARSECOMPILATIONUNIT$QWORD$QWORD$SHORTSTRING$LONGINT$BOOLEAN$$QWORD
0000000004559472 0000000000001558 T SYSUTILS_$$_INTSTRTODATE$crcF7EBEE9E
0000000004469568 0000000000001568 T CLASSES$_$TREADER_$__$$_READPROPERTY$TPERSISTENT
0000000004471488 0000000000001598 T CLASSES$_$TREADER_$__$$_READPROPVALUE$TPERSISTENT$POINTER
0000000004548528 0000000000001665 T SYSUTILS_$$_FLOATTODECIMAL$TFLOATREC$formal$TFLOATVALUE$LONGINT$LONGINT
0000000004659088 0000000000001740 T SYSCONST_$$_GETRUNERROR$WORD$$ANSISTRING
0000000004261232 0000000000001740 T SYSTEM_$$_UTF8TOUNICODE$PUNICODECHAR$QWORD$PCHAR$QWORD$$QWORD
0000000004452256 0000000000001791 T CLASSES$_$OBJECTTEXTTOBINARY$TSTREAM$TSTREAM_$$_PROCESSVALUE
0000000004464944 0000000000001938 T CLASSES$_$TREADER_$__$$_READCOMPONENT$TCOMPONENT$$TCOMPONENT
0000000004562720 0000000000001959 T SYSUTILS$_$INTSTRTOTIME$crcC811E3A3_$$_SPLITELEMENTS$TTIMEVALUES$LONGINT$$BOOLEAN
0000000004545504 0000000000001991 T SYSUTILS$_$FLOATTOTEXTFMT$crcBF2DB92A_$$_FLOATTOSTR
0000000004392144 0000000000002009 T CLASSES$_$TSTRINGS_$__$$_SETDELIMITEDTEXT$ANSISTRING
0000000004446000 0000000000002092 T CLASSES$_$OBJECTBINARYTOTEXT$crcD2CC83D6_READPROPLIST$ANSISTRING_$$_PROCESSVALUE$crc18278EC0
0000000004505984 0000000000002280 T SYSUTILS_$$_FEXPAND$RAWBYTESTRING$$RAWBYTESTRING
0000000004496944 0000000000002286 T SYSUTILS_$$_FEXPAND$UNICODESTRING$$UNICODESTRING
0000000004228592 0000000000002378 T SYSTEM_$$_VAL_REAL$SHORTSTRING$INT64$$EXTENDED
0000000006947296 0000000000002400 d TC_$SYSUTILS_$$_CODEPAGENAMES
0000000007009936 0000000000002496 b U_$SYSTEM_$$_MT
0000000004221920 0000000000002558 T SYSTEM_$$_STR_REAL$SMALLINT$SMALLINT$EXTENDED$TREAL_TYPE$OPENSTRING
0000000004567680 0000000000003342 T SYSUTILS$_$DATETIMETOSTRING$crcFCD1FCF1_$$_STOREFORMAT$ANSISTRING$LONGINT$BOOLEAN
0000000004584896 0000000000003929 T SYSUTILS_$$_UNICODEFORMAT$UNICODESTRING$array_of_const$TFORMATSETTINGS$$UNICODESTRING
0000000004577648 0000000000003929 T SYSUTILS_$$_WIDEFORMAT$WIDESTRING$array_of_const$TFORMATSETTINGS$$WIDESTRING
0000000004210720 0000000000003968 T SYSTEM_$$_K_REM_PIO2$TDA02$TDA02$SMALLINT$SMALLINT$SMALLINT$$INT64
0000000004524704 0000000000004136 T SYSUTILS_$$_FORMAT$ANSISTRING$array_of_const$TFORMATSETTINGS$$ANSISTRING
0000000007013744 0000000000005056 b U_$LNFODWRF_$$_E
0000000004485312 0000000000005305 T CLASSES$_$TWRITER_$__$$_WRITEPROPERTY$TPERSISTENT$POINTER
0000000006940640 0000000000006656 d TC_$SYSUTILS_$$_CODEPAGEHASHES
0000000004532912 0000000000007178 T SYSUTILS_$$_FLOATTOSTRFINTL$crc9799277B


String formatting wastes a lot

Awkward

  • Jr. Member
  • **
  • Posts: 68
Re: list of units without SysUtils/Classes uses
« Reply #23 on: June 22, 2016, 03:35:32 pm »
I agree with Thaddy, just direct all minimalists to KOL and let them deal with it :-)

To use KOL for non-visual things only (if i need multiplatform code)? Isn't it not best way? Btw, that is thing which i don't like a little, mix visual and non-visual code in one module. and i tried to compile Kol with some different settings now, not Dephi mode = problems (and a lot of strange conditions inside, orientatio to old delphi compilers, assembler routines which unusable  and unneded often... nvm)

Awkward

  • Jr. Member
  • **
  • Posts: 68
Re: list of units without SysUtils/Classes uses
« Reply #24 on: June 22, 2016, 03:39:25 pm »
String formatting wastes a lot
and this is not single thing. But... delphi compatibility! :(
if only  we was able to choose, what to use (auto or manually init required things), at least, in objfpc mode (for example) or by conditional directive, size and even program speed can be better, or course.
« Last Edit: June 22, 2016, 03:41:47 pm by Awkward »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8896
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #25 on: June 22, 2016, 07:24:14 pm »

You can make them rational with nm


Just make sure you divide all sizes by the numbers in "df" then. Using that metric, FPC's binary sizes go down spectacularly over time.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8896
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #26 on: June 22, 2016, 07:27:16 pm »
To use KOL for non-visual things only (if i need multiplatform code)? Isn't it not best way? Btw, that is thing which i don't like a little, mix visual and non-visual code in one module. and i tried to compile Kol with some different settings now, not Dephi mode = problems (and a lot of strange conditions inside, orientatio to old delphi compilers, assembler routines which unusable  and unneded often... nvm)

Note that my remark was not just to be snide and negative. One of problems with minimalism is that they trigger a lot of discussion, but when the general populace doesn't care (that much) it fizzles out. I already diagnosed that when I wrote the original "size matters" document.

Rallying all people around one library might actually bring their agenda forward.

Thaddy

  • Hero Member
  • *****
  • Posts: 10573
Re: list of units without SysUtils/Classes uses
« Reply #27 on: June 22, 2016, 09:58:56 pm »
Well. I concur Marco ;) .
In many ways KOL has passed its sell-by date.
But it is still a valid option to use Object Pascal in a non-violent manner at least on the Windows platforms.
I mean, for god's sake rtti, initialization code all over the place, in sysutils?, all kind of up-arse bullshit where it does not belong, that contaminates code. And Object Pascal libraries in both flavours suffer from that contamination. Hm. Why didn't these guys listen to whatever his name is ;) 640 KB is plenty enough.... Oh, well..

Not writing optimal code is still a sin. Writing it knowingly is a crime.

 

TinyPortal © 2005-2018