Yes at the moment linux is in the right pocket until linux catches up. Then will swap. I am talking about the neo freerunner vs. the eten m800. After months of problems with it the m800 is stable, I have quite a lot of software on the device that the freerunner would not provide at the moment.
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);
}
… 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:
- vimpress
- another vimpress … I was informed that the second is the same
- http://coopblue.com/blog/2006/06/posting-to-wordpress-from-vim-with-tags-and-markdown/ and the markdown vim mod
I mean use vim editor on your pocket pc as you use it on your desktop.
For those who are (almost) fanatic with this editor I have to tell you that vim works on pocket pc. Rainer Keuchel ported already years ago along with other gnu tools the vim 6.0 to pocket pc. He wrote himself a posix library (celib) to help this porting.
Well the vim 6.0 works perfect, just one has to take the runtime files for version 6.0. I tried other editors, but all had problem to open a 20MB file. But vim did it!! And text searching is light fast. Microsoft word also manages to open larger files, but searching speed cannot be compared.
I have my personal wiki engine written in vim, todos etc. This was for me the most wanted piece of software for pocket pc.
I am planning to port the version 7.1 for pocket pc. I tried using the above mentioned celib.dll and the header files. I reduced the compilation errors to 0, however I have some linking errors due to some global variables from the celib.dll. Keep tuned, soon (I hope) we will have a running vim 7.1
I also tried to build using another library wcelib, but with this library it seem to be more difficult.
Another option is to use cegcc. Cegcc has two products
* arm-cegcc: toolset to port unix source to Windows CE
* arm-mingw32ce: toolset to build native Windows CE application
I tried to write a makefile+config.h+config.mk to build with these, but I have faced few problems… Continue to fight…