Turns out where I am has internet access. I realized that the code above didn't allow for the first number to be under ten. That's fixed as well as the problems with zero. Going to run some final tests, I'll post the final code if anyone cares to see it. It's 634 bytes and is pretty quick, anyone have better (probably do)?
how far have you gotten on this so far.
Yeah, I too would be interested in seeing how this project turned out. Got that code, perchance?
This has taken a backseat to a lot of things right now. I did get the list compressor working though. Very little production, just a couple of routines that I'll need. I believe I do have it with me, I'll see if I can figure out which ones are the final version.
Excellent. Always good to have more code fragments up on the 'net for new programmers to learn from.
Found the list compression stuff. The list is stored in LFILE1.

Compression, 237 bytes

Code:
 2->dim(LB:1000->Q:1->C:Ans->D:(10>LFILE1(1->LB(2:LFILE1(C->LB(1
For(B,1,dim(LFILE1)-1
C+1->C
100LB(D)+LFILE1(C->LB(D
If not(LFILE1(C
Then
C/Q+LB(D+1->LB(D+1:1000Q->Q:End
If not(fPart(C/6
Then
D+2->D
2+dim(LB->dim(LB
(10>LFILE1(C->LB(D+1
LFILE1(C->LB(D
1000->Q
End
End
LB->LFILE1:DeLVar LB


and decompression, 422 bytes


Code:
DelVar DDelVar C–1->B
For(A,1,dim(LFILE1)-1,2
B+2->B
Repeat not(iPart(Ans
D+2->D
LFILE1(B)/10^D
End
D-2->D
If 1=LFILE1(B+1
Then
C+1->C
iPart(LFILE1(B)/10^D)-100iPart(LFILE1(B)/10^(D+1->LB(C
D-2->D
End
D/2+(A=dim(LFILE1)-1->F
If not(LFILE1(B
Then
C+1->C
0->LB(C
1->F
End
For(E,1,F
C+1->C
If C=iPart(1000fPart(round(LFILE1(B+1),3
Then
Repeat not(fPart(LFILE1(B+1
0->LB(C
C+1->C
iPart(LFILE1(B+1))+1000(LFILE1(B+1)-iPart(1000LFILE1(B+1))/1000->LFILE1(B+1
2+dim(LB->dim(LB
End
Else
iPart(LFILE1(B)/10^D)-100iPart(LFILE1(B)/10^(D+2->LB(C
End
D-2->D
End
End
LB->LFILE1:DelVar LB


I thought it was smaller. It's fairly good and quick though. I'll try to get some stats on that later. Not sure what I changed between version...
/me looks it over.
Ah, you seem to have a standard bitpacking scheme going on there. Nice job.
Yeah, it is. Thanks.
Now that I think about it, actually, it seems to me that Kllrnohj came up with a similar scheme that was extremely efficient in terms of both size and speed. Anyone know where that went?
KermMartian wrote:
Now that I think about it, actually, it seems to me that Kllrnohj came up with a similar scheme that was extremely efficient in terms of both size and speed. Anyone know where that went?



My list compression:
http://www.ticalc.org/archives/files/fileinfo/371/37195.html

Note: that version is still a bit unoptimized, and a speed increase can be obtained by using a temp var instead of a list, but it works Smile
Yeah, that's larger than mine by 342 bytes though as far as I know it's slightly better.
Sage Orator wrote:
Yeah, that's larger than mine by 342 bytes though as far as I know it's slightly better.


The size of the compression routine itself is of little consequence compared to the SPEED and the compression RATE. Compare those aspects of mine to yours and then see which is better Smile (I'm not saying mine necessarily will be, but that just raw file size is a pretty weak comparison Razz )
Actually mine is quicker, especially at decompression. Pretty much by far. Your program is still better at compression rate, around 4.3 to around 4.8. Alone and for just compression your program would be much better, but I feel that mine's better as a subroutine.
what is your compression rate? Do remember that compression rate is by far the most important aspect, as you aren't (or shouldn't) be running a routine like that often Razz
It compresses at an average of 4.3x as opposed to your 4.8. That's why I said your program would be much better alone. Just the speed of decompression and with the size of the program it seems to mine more appealing inside another program. Different programs for different reasons.
Yeah, but these are nearly the same program designed for identical reasons Razz I was just curious, I'm not trying to force you to use mine - just remember that mine still needs some serious optimizing, which I did do, but never bothered to upload it, cause I'm lazy like that Wink
Heh, I noticed. How much did it help though?

It's okay, but mine was designed for this specific program. I'm going to use mine either way.
It greatly sped it up in both decompressing and compressing.. I'll have to post it later... maybe... eh, screw it Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement