Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparison QB64 compiled with gcc optimizations and without
#34
i discover day by day interesting features in qb64. today it's about _Deflate (compression) and _Inflate (decompression) functions. i wanted to test them. here is the result :

program compiled with qb64 -O3 :

Function _Deflate : 10.1x seconds
Function _Inflate : 1.2x seconds

program compiled with original qb64 :

Function _Deflate : 10.1x seconds
Function _Inflate : 1.2x seconds

the result of the comparison is almost zero in terms of processing speed. i examined the compilation directives of the original version of qb64. it turns out that the compression and decompression module is compiled with the -O3 option. nothing surprising to this result.

on character strings, compression is very efficient and decompression is very fast. this should allow to reduce efficiently the disk space occupied by text data...

Code: (Select All)
Dim tab$(19)
tab$(0) = "malevolently malevolous malexecution malfeasance malfeasant malfeasantly malfeasants malfeasor overwon"
tab$(1) = "malfed malformation malformations malformed malfortune malfunction malfunctioned malfunctioning overwood"
tab$(2) = "malgovernment nonemotionalism nonemotionally verwing overwinning overwinter overwintered overwintering"
tab$(3) = "nonemanating nonemancipation nonemancipative nonembarkation nonembellished nonembellishing overwiped"
tab$(4) = "nonembellishment nonembezzlement nonembryonal nonembryonic nonembryonically nonemendable overwithered"
tab$(5) = "nonemendation nonemergence nonemergent nonemigrant nonemigration nonemission nonemotional overwomanize"
tab$(6) = "overwisdom overwise overwisely overwoman overwomanly overwooded overwoody overword overwords overwore"
tab$(7) = "overwork segreant segregable segregant segregate segregated segregatedly segregatedness segregateness"
tab$(8) = "segregates segregating segregation segregational segregationist segregationists segregative segregator"
tab$(9) = "teleostean teleostei teleosteous teleostomate teleostome teleostomi teleostomian teleostomous teleosts"
tab$(10) = "teleotemporal teleotrocha teleozoic teleozoon telepath telepathy telepathic telepathically telepathies"
tab$(11) = "telepathist telepathize nffroze unfibbed unfibbing unfiber unfibered unfibred unfibrous unfibrously"
tab$(12) = "unfickle unfictitious unfictitiously unfictitiousness unfidelity unfidgeting unfiducial unfielded"
tab$(13) = "unfiend unfiendlike unfierce unfiercely unfiery unfight unfightable unfighting unfigurable unfigured"
tab$(14) = "zulus zumatic zumbooruk zuni zunian zunyite zunis zupanate zurich zurlite zutugil zuurveldt zuza"
tab$(15) = "zwanziger zwieback zwiebacks zwieselite zwinglian zwinglianism zwinglianist zwitter zwitterion"
tab$(16) = "zwitterionic cognovits cogon cogonal cogons cogovernment cogovernor cogracious cograil cogrediency"
tab$(17) = "cogredient cogroad cogs cogswellia coguarantor coguardian cogue cogway cogways cogware cogweel"
tab$(18) = "cogweels cogwheel cogwheels xiphistna xiphisura xiphisuran xiphiura xiphius xiphocostal xiphodynia"
tab$(19) = "xiphodon xiphodontidae xiphoid xyphoid xiphoidal xiphoidian xiphoids xiphopagic xiphopagous xiphopagus"
Color 7: Print "Wait..."
Color 2: Print: Print " generation of test string..."
Dim tabch$(15)
For boucle% = 1 To 15
    chaine$ = ""
    For nbr% = 1 To 10000
        chaine$ = chaine$ + tab$(Rnd * 19)
    Next nbr%
    tabch$(boucle%) = chaine$
Next boucle%
Dim chcompress$(15)
Color 3: Print: Print " compress string 100 times in : ";
start = Timer(.001)
For nbr% = 1 To 100
    For boucle% = 1 To 15
        chaine$ = tabch$(boucle%)
        chcompress$(boucle%) = _Deflate$(chaine$)
    Next boucle%
Next nbr%
Print Timer(.001) - start; "seconds"
Color 14: Print
For boucle% = 1 To 15
    Print " len string original : "; Len(tabch$(boucle%)); " -->  Compressed : "; Len(chcompress$(boucle%))
Next boucle%
Color 3: Print: Print " Decompress string 100 times in : ";
start = Timer(.001)
For nbr% = 1 To 100
    For boucle% = 1 To 15
        chaine$ = chcompress$(boucle%)
        tabch$(boucle%) = _Inflate$(chaine$)
    Next boucle%
Next nbr%
Print Timer(.001) - start; "seconds"
Color 7
End
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Coolman - 05-20-2022, 12:51 PM



Users browsing this thread: 12 Guest(s)