Warning: session_start() [function.session-start]: open(/tmp/sess_24e0c545fd72b86e1248f53699eb970c, O_RDWR) failed: Read-only file system (30) in /www/weirdsilence/weirdsilence.net/www/index.php on line 30
Weird Silence » Pure C
   News      Software      Tools      Forum      Downloads      Links      About  
Login

Pure C

I haven't coded a lot in C, so you should check to see if you can find any bugs. Wanting to see how much speed we could squeeze out of our implementation/algorithm, we had to write it in C (or assembler, which Niklas didn't feel like ;) - And this is the result.
The C3 server, with optimizations, consistenly does around 1300000 lookups per second when compiled with -DUSEFASTIP2LONG, and around 900000 without (which is safer if you are not sure that you will only give valid IP addresses to the code).
My P4 2GHz, compiled with MS Visual C++ Optimizing compiler (the free kit from MS) I get app. 3,2 million lookups per second when compiled with -DUSEFASTIP2LONG, and around 2,7 million without! Kind of puts the performance of the other languages in perspective ;)
If you give ip2c_bench.exe an argument, it will print out the IP addresses, and their corresponding country, if you'd like to check the validity.

Downloads

ip2c-0.9.2.tar.bz2 - C source code bzip2'ed (393 KB)
ip2c-0.9.2.zip - C source code zipped (332 KB)

Windows .exe of C implementation

If you don't feel like compiling your own on windows, and want to test out the app, we pre-built the command line tool (ip2c.exe) and the benchmarker (ip2c_bench.exe) for you to download here. They require a Pentium Pro or better.

Download ip2c-winexe-0.9.2.zip (376 KB)



MySQL: 0.0000 s, 0 request(s), PHP: 0.0191 s, total: 0.0191 s, document retrieved from cache.
Get Firefox!
Etomite »

« Etomite Parse Error »

Etomite encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
 
PHP error debug
  Error: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) 
  Error type/ Nr.: Warning - 2 
  File: /www/weirdsilence/weirdsilence.net/www/index.php 
  Line: 118 
  Line 118 source: if(@!$this->rs = mysql_connect($this->dbConfig['host'], $this->dbConfig['user'], $this->dbConfig['pass'])) {  
 
Parser timing
  MySQL: 0.0000 s s(0 Requests)
  PHP: 0.0297 s s 
  Total: 0.0297 s s