Archive for June, 2008
vim: opening large files is slow…

I am using vim to edit/view large files (> 600MB). Unfortunately, it looks like opening such large files even on a Pentium 3.4Ghz with PATA disk takes quite some time (17sec)(ubuntu, kernel 2.6.22-14). I know that vim
creates some internal tree representation of the file, but I wonder if something could be tuned, so that such loading times decrease, even if memory usage would increase.

I tried to open a 767.187.800 bytes file (I created this file by cat-ing all vim src files 100 times ) :

time vim -u ./.vimrc –noplugin -c”:q” ../all3.c

the result is:

real 0m17.670s

user 0m15.457s

sys 0m1.428s

the .vimrc contains only

set noswapfile

I profiled vim, and opening the same file I got the results below….

So the question would be, is it possible to tune sthg. to open faster
these files??

here is the gprof head

XXXXX$ head -40 no_swap

Flat profile:

Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
46.12 1.96 1.96 1 1.96 4.22 readfile
23.53 2.96 1.00 31025600 0.00 0.00 ml_append_int
12.94 3.51 0.55 31025601 0.00 0.00 ml_updatechunk
8.24 3.86 0.35 31361959 0.00 0.00 ml_find_line
4.94 4.07 0.21 31025600 0.00 0.00 ml_append
0.47 4.09 0.02 1876672 0.00 0.00 mf_put
0.47 4.11 0.02 1655954 0.00 0.00 mf_find_hash
0.47 4.13 0.02 1655954 0.00 0.00 mf_get

opening the same file with grep or with the script below takes on the same machine around 0.25 seconds

#include <unistd.h>
#include <fcntl.h>
int main(int argc, char ** argv)
{
if(argc < 1) {
printf(”file name not provided..\n”);
return -1;
}
int fd = open(argv[1], O_RDONLY);
if(fd < 0) {
printf(”cannot open file %s”, argv[1]);
return -1;
}
int chunk_size = 1000;
if(argc > 2) {
chunk_size = atoi(argv[2]);
}
char *buffer = (char * )malloc(chunk_size);
int res, count = 0;
while( (res = read(fd, buffer, chunk_size) ) > 0) {
count ++;
}
printf(”total read %d*%d=%d”, count, chunk_size, count*chunk_size);
}

eten glofiish m800 defect…

As I was writing here, my eten m800 is defect, but the bad news is I will have to stay without it more than 1 month, as it’s home country is more than very far from here…

does techorati do his job?

<a href=”http://technorati.com/claim/ugk8ypqcv5″ rel=”me”>Technorati Profile</a>

press that word with vim … or posting wordpress blog with vim

… the statement <the swiss knife in editing is vim> might not necessarily convince several people for two reason: several people would not agree that when your are out in the nature, the tool that brings most of added value is as swiss knife…. On the other hand, few editors know the power of vim. And another handicap… few people might have heard about the power of vim, but the same time they have heard about the unfriendly learning curve of this tool…

the threashold to start blogging has different components. If one of these components has a high value you would newer start blogging… Of course evaluating that value is often rather a psychological process… I have postponed the moment of starting blogging due to - maybe exaggerated - desire to have the text that I write in vim with minimal effort and best quality on the blog site… In the moment I write this, I did not invent a simplified process for that, but i will try to gather here all what one can find on internet having any relationship between the two concepts ‘vim editor’ and ‘blogging’ (and maybe ‘wordpress’ … ) so that I can say I am pressing that word with vim…

So far here are the candidates:

  1. vimpress
  2. another vimpress … I was informed that the second is the same
  3. http://coopblue.com/blog/2006/06/posting-to-wordpress-from-vim-with-tags-and-markdown/ and the markdown vim mod
nfs is slow on ubuntu, it is a nightmare… copying 1000 files of 10kbyte 20* much slower than scp…

By having more and more devices around at home, it makes sense to keep all data in one place. I have a server for longer time, that runs a samba server, nfs file server and is acting as host for VirtualBox and Xen virtual machines. I had finally time to complete another phase of this “move everything to server”, by using a central home directory for all the clients.

The experiment was so far not completely successful as the writing speed towards the server is horribly low. I made the following experiments

1. Measured the ip speed with iperf in both directions between the client and server.

on the server:

xxx@yyyyyyyyy:~$ iperf -s
————————————————————
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
————————————————————
[ 4] local 192.168.12.5 port 5001 connected with 192.168.12.11 port 56444
[ 4] 0.0-10.0 sec 753 MBytes 630 Mbits/sec

on the client

uuuuu@qqq:~$ iperf -c 192.168.12.5
————————————————————
Client connecting to 192.168.12.5, TCP port 5001
TCP window size: 16.0 KByte (default)
————————————————————
[ 3] local 192.168.12.11 port 56444 connected with 192.168.12.5 port 5001
[ 3] 0.0-10.0 sec 753 MBytes 631 Mbits/sec

so the transfer rate is quite good (630Mbits/sec) for a Gbit card on both side as the server has a slower PCI.

2. Copied a 100MByte file from the server to the client, it took 1.6 sec

3. copied a the same 100MByte file from the client and it took 60sec!!! so 10 times slower!!! Cannot beleive….

Here is the line from /etc/fstab for the /home folder

192.168.12.5:/XXXXXX/home /home nfs4 auto,rw,nodev,sync,_netdev,noatime,proto=tcp,retry=10,rsize=32768,wsize=32768,hard,intr 0

4. By changing the sync parameter to async there was some significant improvement, but still far from perfect… copying from the server remained 1.6 sec, and copy to the server dropped to 3.6 sec. The same copy on the server, locally takes 1.7 sec.

This means that copying through nfs is twice slower than a local copy without having network bottleneck.

4. Copying 1000 files of 100kbyte from server to client took ~3sec, but back to the server 45secs!!!!! This is really painful. This made it clear, why programs like firefox slowed down since the nfs home. Firefox writes several small files quite often, so …

5. And now some comparison about (half) alternatives. Copying with scp the same 1000 files to the server took 12secs, so almost a quarter of the time spent with nfs.

Important to mention that there is no router between the computers, they are connected with a cat6 cable (gigabit ethernet).

Any suggestion if this copy time could be decreased?

wiki markup… what is the best if your input device is limited

As you may know one of the issues in selecting a wiki engine is the syntax. Some people do not face this aspect as they ignore the differences of the syntax of different implementations. In some enterprises the person responsible for evaluating wiki engines is even not aware about these differences in syntax.

The site http://www.wikicreole.org organized itself in form of wiki tries to define some standards based on the feedback of different users. The engine used by them is the mediawiki,JSPWiki therefore it is easy to guess that they try to promote the notation used on mediawiki. So far this is not bad as, probably the most used engine is the mediawiki, and several users agree that the notation is. However I think the less agreed topic is the syntax for internal links.

On the page http://www.wikicreole.org/wiki/Talk.LinksReasoning, there are some discussins, about which form of syntax should be standardized for links .

Personally I would not make any difference between external or internal syntax and this should be as following.

[This is a link]

this could be extended to

[This is a link|with this and that proporties]

Arguments:

The argument is related to economy of writing and encoding. In a well structured wiki, ideas/concepts are splitted up to an optimal size/granularity, that is depending on the topic of that wiki. This involves that pages will contains lots of links to each other, and probably the most used “sign” would be that for link. Why the user would not have the simplest tool to write these links. Why would it not be enough to write [this page] with only ONE square bracket?? If one would use the single bracket for some other purpose there are different ways to “escape” that character.

My argument is much powerful on handheld devices where you have limited input capabilities…

short life Eten glofiish M800 …

Update: a friend of mine has received his eten m800 with defect. So in my friends-circle, 3 eten m800, and all had a very short life!!!!

******

With great disappointment, I have to recognize that the Eten Glofiish M800 has quite high failure rate. Why do I say that? Because my Eten m800 has ceased to work. To be more precise the GSM driver cannot load and after a few minutes the entire phone freezes. Nor reinstalling the ROM nor upgrading does help… Oh… just to support my theory…. my friends devices (the same M800) has completely died few days ago… his one does not boot anymore… So 2 devices the same type crashing after 3 months of usage… I WANT MY MONEY BACK…