Author Topic: QB64 v1.4 Release Candidate up for testing  (Read 18824 times)

0 Members and 1 Guest are viewing this topic.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #15 on: January 23, 2020, 03:42:50 pm »
Downloaded, installed and ran my main project on it. Any other enhancements in this one? It seemed to handle a 3D graphic rotation routine smoother than 1.3 did.

Looking forward to $NOPREFIX, that's always been a bit of a pain.

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #16 on: January 23, 2020, 04:11:55 pm »
Downloaded, installed and ran my main project on it. Any other enhancements in this one? It seemed to handle a 3D graphic rotation routine smoother than 1.3 did.

Looking forward to $NOPREFIX, that's always been a bit of a pain.

Glad you're helping us test it out, OldMoses. Please report back if you find anything out of place.

I don't think we have touched the graphics system tho. You may have been too hopeful :-)

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #17 on: January 23, 2020, 04:30:17 pm »
Our wiki has already been updated with the upcoming statements and functions, and the first post in this thread has also been updated with links to the new articles: https://www.qb64.org/forum/index.php?topic=2103.msg113347#msg113347

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #18 on: January 23, 2020, 04:47:31 pm »
Question: http://www.qb64.org/wiki/INFLATE$

Has _INFLATE$ been altered to no longer accept the optional size parameter, or is the wiki just missing it?  Originally it allowed for an optional parameter to save extracting over and over in a DO...LOOP until the proper size is allocated to hold and return the decompressed data.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #19 on: January 23, 2020, 04:56:58 pm »
Nothing changed, I just didn't add it because I didn't understand it. Care to elaborate? 😁

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #20 on: January 23, 2020, 05:53:59 pm »
Nothing changed, I just didn't add it because I didn't understand it. Care to elaborate? 😁

Zlib doesn’t track the original size of our file, nor our compression ratio for us.  It simply takes the string of our data which we give it and then crunches it down into a compressed form.  So lets say we start with a file of 1000 bytes in size.  If it’s text, it might compress down to 40 bytes...

When we send that 40 bytes back to zlib to decompress, zlib has do idea of how compressed it is, or how much memory it needs to uncompress it.  Unless we tell it the size of memory it needs to reserve, it runs a trial-and-error decompression method for us.

PASS 1; Reserve 100 bytes...  Attempt decompress...  FAIL, not enough memory to fully decompess.
PASS 2; Reserve 200 bytes... Attempt decomress... FAIL.
PASS N; Reserve 10000 bytes...  Attempt decompress...  SUCCESS!  Return the 1000 bytes of the original, free the temp memory.

That optional parameter lets us bypass that trail and error by telling it the exact size it needs to reserve to return our uncompressed data back to us.

PASS 1: Reserve 1000 bytes of memory.  Decompress...  SUCCESS... Return 1000 bytes.

(Of course the values aren’t set in 100s of bytes, but instead are much larger by default internally, but it highlights the process.)

For people who are worried about efficiency and minimal memory use, they’re much better served if they use the optional parameter to manually set the return size — especially if dealing with large files which may need multiple attempts at resizing to reserve the right amount of memory for the full decompression.

Use would be similar to:

Text$  = “Whatever we want to compress.... lots more junk”
OriginalSize = LEN(text$)
Compressed$ = _DEFLATE$(text$)
... other program stuff you want to do...
Decompressed$ = _INFLATE$(Compressed$, OriginalSize)

The above tells Zlib the exact amount of memory it needs to reserve the data we send it...  Without that optional parameter, it just makes a guess at what’s needed, and then guesses bigger and bigger, until it either succeeds or runs out of memory and finally pops an error.



Inflate without size is for quick and easy coding.  Inflate with size is for efficient, quicker programs.  If I just wanted a demo for the forums, I probably wouldn’t worry about that parameter (or if I knew my extracted file sizes were small).  If I was concerned about FPS, for video ot a game, then I’d store those values and be certain to use them with the command.



EDIT to expand:

And for those curious, I just checked our source to get default size: _INFLATE reserves 10MB by default as a memory buffer to extract to, and increases the buffer by 10MB per pass until it’s large enough to hold your uncompressed data. 
« Last Edit: January 23, 2020, 06:01:41 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #21 on: January 23, 2020, 06:23:05 pm »
All clear now. Please check it: http://www.qb64.org/wiki/INFLATE$

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #22 on: January 23, 2020, 06:26:55 pm »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #23 on: January 23, 2020, 07:51:02 pm »
An initial observation, which seems a relatively minor glitch. The line number display (on left edge) of 1.3 has the line highlight color which remains solid when scrolling with the mouse wheel, while 1.4 blinks/flashes between highlight color and background when scrolling in 1.4.

Edit: scratch that...now it's behaving alright. Not sure what caused that the first time. Maybe it's just me doing something weird.
« Last Edit: January 23, 2020, 07:54:00 pm by OldMoses »

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #24 on: January 23, 2020, 07:53:05 pm »
Is that with $NOPREFIX on?

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #25 on: January 23, 2020, 07:54:47 pm »
Is that with $NOPREFIX on?

Yes, both times.

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #26 on: January 23, 2020, 08:01:17 pm »
If it's good now, then it's good 😁

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #27 on: January 23, 2020, 08:15:20 pm »
All clear now. Please check it: http://www.qb64.org/wiki/INFLATE$

Guys, is this mainly for shrinking text size before storing it in a file?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #28 on: January 23, 2020, 08:26:29 pm »
You can compress binary data too.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #29 on: January 23, 2020, 09:49:00 pm »
Guys, is this mainly for shrinking text size before storing it in a file?

Pete

Compressing any data. After all, this is how PNG format files compress the data inside them.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!