Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BZip2 Swift port

This is a working proof of value port of original BZip2 code.

Goals

  1. Can an other AI write a good prompt for this task.
  2. Let an AI convert a tool from one language to other, especially to Swift.
  3. How expense is this translation.
  4. What are main errors from AI.

no goal

  1. the code quality, because programms has to work at the user computer and no code had to be blinking in the eye of coder. The test cases are only on business requirements.

Solutions

  1. Yes, with minimal additions and give to the AI the original source code and the original testcases.
  2. It works in less than one hour with a "normal AI model" like Claude Sonnet 5.
  3. The AI works and I as good developer drink coffee and eat pizza.
  4. First solution has many errors. So it is important to required tests, more tests, much more tests. Give these errors to AI, without hints, and the AI correct themselfe. Only one big error and this was a newbie mistake to ignore a pipe can be busy.

Plus: The port is for the user faster than original, because AI insert multithreading.

Maxmilian:enwik$ ls -lisa enwik9.tar                                            
432127629 1953128 -rw-r--r--  1 bastie  staff  1000001536  3 Juli 16:37 enwik9.tar
Maxmilian:enwik$ bzip2 --version                                                
bzip2, a block-sorting file compressor.  Version 1.0.8, 13-Jul-2019.
   
   Copyright (C) 1996-2019 by Julian Seward.
   
   This program is free software; you can redistribute it and/or modify
   it under the terms set out in the LICENSE file, which is included
   in the bzip2 source distribution.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   LICENSE file for more details.
   
bzip2: I won´t write compressed data to a terminal.
bzip2: For help, type: ´bzip2 --help´.
Maxmilian:enwik$ time bzip2 -9kf enwik9.tar                                     
bzip2 -9kf enwik9.tar  48,21s user 0,71s system 99% cpu 48,946 total
Maxmilian:enwik$ ls -lisa enwik9.tar.bz2   
432481345 525312 -rw-r--r--  1 bastie  staff  253985866  3 Juli 16:37 enwik9.tar.bz2
Maxmilian:enwik$ md5sum enwik9.tar.bz2                                          
0665db0a37cf230f276287b56e7a1275  enwik9.tar.bz2
Maxmilian:enwik$ time ./.build/release/bzip2 -9kf enwik9.tar
./.build/release/bzip2 -9kf enwik9.tar  436,37s user 2,25s system 1032% cpu 42,478 total
Maxmilian:enwik$ ls -lisa enwik9.tar.bz2                                          
432481345 496072 -rw-r--r--  1 bastie  staff  253985866  7 Juli 14:21 enwik9.tar.bz2
Maxmilian:enwik$ md5sum enwik9.tar.bz2                                            
0665db0a37cf230f276287b56e7a1275  enwik9.tar.bz2
Maxmilian:enwik$

Compare User Time

User Time, the time user wait for ending of process.

BZip2 Version enwik9.tar %
1.0.8 original C 0:48,949 100.00
1.0.8 parallel Swift 0:42,478 86.78
1.0.8 parallel, GPU Swift 0:33,695 68.84

Version

  • BZip2 1.0.8 with GPU support.
  • BZip2 1.0.8 ported from C to Swift with AI. It contains also multithreading.

Releases

Contributors

Languages