Re: Christmas gift - new game
- Posted by Davi Figueiredo <davitf at USA.NET> Dec 22, 1998
- 482 views
Ralf wrote: >What algorithm did you use ? >Or did you make up your own ? >If so, chances are it can get pretty speed with Euphoria. Most algorithm use >some sort of 'I already have this written down somewhere' and need to 'find' >it. A finding procces can usually be sped up a lot using hash-tables, >esspecially in Euphoria you can do *that* pretty fast. I'm using a method called the Burrows-Wheeler Transform. It is not a compression algorithm itself, but it transforms the original data so that it becomes more compressible. The decompressor can retrieve the original file from the transformed data. After applying this algorithm (which is the slowest part), the data is Huffman-compressed. >And I forgot, one of the biggest bottle necks in Euphoria is IO due to the >conversion of bytes etc to 4-byte machine integers, etc. and the fact that >you have to check if it is -1 every time in your code. Jaquesch Deschenes (I >think I misspelled his name now) had an library for this that might be much >much faster. You can have you code deal 4 bytes being 4-byte machine >integers, and have the library handle the file one big cached block at the >time. I would say, put profile_time on and just see where you the speed is >going to and eh.. where not. I am already using profile_time :) Anyway, it seems like the IO is fast compared to the rest of the algorithm. The slowest part of it is that the program has to sort a sequence of numbers that point to positions in another sequence, based on the bytes stored in that other sequence. My fastest algorithm sorts a 164000-element sequence in about 10 seconds (in my PII, so it will be even slower than that in older computers). Here's a question not directly related to speed but that is important to my program because I have to store the whole file in a sequence: a sequence containing only integers will take 4 or 8 bytes per element? I know that an integer is stored in 4 bytes, but I'm not sure if there is a header. I tried storing the file in memory and read it using peek(), but it seems to be slower than working with sequences. Regards, Davi Figueiredo davitf at usa.net ____________________________________________________________________ Get free e-mail and a permanent address at http://www.amexmail.com/?A=1