list of units without SysUtils/Classes uses lazarus / 62-General ---------------------------------------------------------------------- Awkward · 2016-06-21 10:36 i know, it stupid but i don't like to uses Classes, SysUtils, Variants etc units because they adds lot of unusable (for me) crap. How can i easily get list of units/components which don't requires these units? Just to be sure what i can use and what i must to implement by myself. ---------------------------------------------------------------------- JuhaManninen · 2016-06-21 10:43 Refactoring menu has "Unused Units ...". It also offers to remove those unused units for you. It is so useful feature that I have set a shortcut key for it. ---------------------------------------------------------------------- Awkward · 2016-06-21 10:52 i know, i know. but i mean what FPC have a LOT of ready useful things but some units links to SysUtils even for things which can be rewritten without such dependences. (it means what SysUtils REALLY used now)  that why i made small copy of FPC units directory with some source fixes to remove unneded units. and have my own "library" for simple things without "Classes" and "SysUtils" dependences. like "Base64" conversion for example. ---------------------------------------------------------------------- JuhaManninen · 2016-06-21 12:01 Ok, so FPC's library code has those unneeded dependencies. You can remove them and create a patch. On the other hand it makes no difference really. Linker includes only the used parts from those units into your executable. ---------------------------------------------------------------------- Awkward · 2016-06-21 12:15 Quote from: JuhaManninen on June 21, 2016, 02:01:48 pmOk, so FPC's library code has those unneeded dependencies. You can remove them and create a patch. On the other hand it makes no difference really. Linker includes only the used parts from those units into your executable. you perfectly knows what linker can't do anything (by default) with initialization/finalization sections ---------------------------------------------------------------------- marcov · 2016-06-21 12:20 No there is no easy way. Most things that do someting will use one of these units. E.g. base64 uses streams which are defined in classes. ---------------------------------------------------------------------- Awkward · 2016-06-21 12:26 Quote from: marcov on June 21, 2016, 02:20:57 pmNo there is no easy way. Most things that do someting will use one of these units. E.g. base64 uses streams which are defined in classes. i know about streams. but what about base64 realization without streams but with memory buffers only? I mean, base64 algorithm  by itself don't have any SysUtils requirements ---------------------------------------------------------------------- Leledumbo · 2016-06-21 19:55 It's kinda hard. Those two units provide too much useful things that most other units have dependencies on. If you're looking for "list of units/components which don't requires these units" I believe the answer is: components: none (components use streaming, streaming is provided by TPersistent, TPersistent is defined in Classes unit)units: most rtl units ---------------------------------------------------------------------- Awkward · 2016-06-21 20:15 Quote from: Leledumbo on June 21, 2016, 09:55:33 pmIt's kinda hard. Those two units provide too much useful things that most other units have dependencies on. If you're looking for "list of units/components which don't requires these units" I believe the answer is: components: none (components use streaming, streaming is provided by TPersistent, TPersistent is defined in Classes unit)units: most rtl units That why i got this question. I going mad when i want to use 1-2 functions which implemented in SysUtils or another units already and i know what it safe and don't want to keep lot of useless stuff in my programs ---------------------------------------------------------------------- marcov · 2016-06-21 20:29 Quote from: Awkward on June 21, 2016, 02:26:01 pmi know about streams. but what about base64 realization without streams but with memory buffers only? A TMemoryStream is a memory buffer. Quote I mean, base64 algorithm  by itself don't have any SysUtils requirements Nothing has. You can etch assembler into ice with an old walrus tooth if you want the ultimate minimalism price. There is just no point. ---------------------------------------------------------------------- Awkward · 2016-06-21 20:57 Assembler  is for critical places ^_^ but why i must to keep exception handler, for example, if i don't need it? why i getting 200+ Kb data+code if i don't use even byte from it? That the problem, what i must write my own code or cut code from otheur units just to avoid useless data ---------------------------------------------------------------------- rvk · 2016-06-21 21:14 Quote from: Awkward on June 21, 2016, 10:15:18 pmI going mad when i want to use 1-2 functions which implemented in SysUtils or another units already and i know what it safe and don't want to keep lot of useless stuff in my programs Are you looking for something like KOL? http://wiki.freepascal.org/KOL-CE http://kolmck.net/ ---------------------------------------------------------------------- Awkward · 2016-06-21 21:27 Quote from: rvk on June 21, 2016, 11:14:45 pmAre 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 · 2016-06-22 05:49 Quote from: Awkward on June 21, 2016, 10:57:18 pmAssembler  is for critical places ^_^ but why i must to keep exception handler, for example, if i don't need it? why i getting 200+ Kb data+code if i don't use even byte from it? That the problem, what i must write my own code or cut code from otheur units just to avoid useless data Why would we distribute four versions of units for the various stages of minimalism. A minimalistic mindset that typically people grow out soon as they really have to finish projeccts in time. ---------------------------------------------------------------------- Awkward · 2016-06-22 07:27 Quote from: marcov on June 22, 2016, 07:49:28 amWhy would we distribute four versions of units for the various stages of minimalism. A minimalistic mindset that typically people grow out soon as they really have to finish projeccts in time. i don't ask you to rewrite all units to my rules, of course, initially, i just asked, is any instrument to find required functional in units which don't have SysUtils etc dependences at least, just to sort them for my needs. nvm, anyway, if i will need something unusual, more than 50% chance what i will write my own solution or change existing but just for my needs ---------------------------------------------------------------------- marcov · 2016-06-22 07:44 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 ---------------------------------------------------------------------- Awkward · 2016-06-22 08:03 Quote from: marcov on June 22, 2016, 09:44:15 amYou 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 · 2016-06-22 08:16 Delphi package support is being worked on in trunk. ---------------------------------------------------------------------- Thaddy · 2016-06-22 11:16 Use KOL. Solved. Has Base64 streams, doesn't use classes or sysutils. Really small exes. Not portable, only on windows flavors. ---------------------------------------------------------------------- Cyrax · 2016-06-22 11:38 Quote from: Awkward on June 22, 2016, 10:03:06 amQuote from: marcov on June 22, 2016, 09:44:15 amYou 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 · 2016-06-22 11:40 Quote from: Thaddy on June 22, 2016, 01:16:09 pmUse KOL. Solved. Has Base64 streams, doesn't use classes or sysutils. Really small exes. Not portable, only on windows flavors. Already said and answered. Quote from: Awkward on June 21, 2016, 11:27:54 pmQuote from: rvk on June 21, 2016, 11:14:45 pmAre 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 · 2016-06-22 13:14 Quote from: Cyrax on June 22, 2016, 01:38:00 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 · 2016-06-22 13:35 Quote from: marcov on June 22, 2016, 03:14:03 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$Q WORD$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$TFLOATR EC$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$crcC811E3A 3_$$_SPLITELEMENTS$TTIMEVALUES$LONGINT$$BOOLEAN 0000000004545504 0000000000001991 T SYSUTILS$_$FLOATTOTEXTFMT$crcBF2DB92A_$$_FLOATTOSTR 0000000004392144 0000000000002009 T CLASSES$_$TSTRINGS_$__$$_SETDELIMITEDTEXT$ANSISTRING 0000000004446000 0000000000002092 T CLASSES$_$OBJECTBINARYTOTEXT$crcD2 CC83D6_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$crcFCD 1FCF1_$$_STOREFORMAT$ANSISTRING$LONGINT$BOOLEAN 0000000004584896 0000000000003929 T SYSUTILS_$$_UNICODEFORMAT$UNICODES TRING$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$arra y_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 · 2016-06-22 13:35 Quote from: marcov on June 22, 2016, 03:14:03 pmI 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 · 2016-06-22 13:39 Quote from: BeniBela on June 22, 2016, 03:35:15 pmString 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. ---------------------------------------------------------------------- marcov · 2016-06-22 17:24 Quote from: BeniBela on June 22, 2016, 03:35:15 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 · 2016-06-22 17:27 Quote from: Awkward on June 22, 2016, 03:35:32 pmTo 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 · 2016-06-22 19:58 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.