[sqlite] Delay during insert - Was: [sqlite] How to cross compile sqlite-3.2.7 for arm9 s3c2410?

2005-09-28 Thread Frank van Vugt
Hi Ron,

> I have noticed that when I create a database and do a simple INSERT, (using
> the sqlite3 binary), there is an appreciable delay (1-2 seconds) before
> sqlite3 returns to the prompt.  When doing SELECT there is no delay.

Mmm, can't say that I have seen any strange delays on the arm platform, albeit 
that it obviously *is* a bit slower than i386 ;). But seriously, given that 
we're talking about a newly created db, a fairly simple table with no 'weird' 
triggers etc, then a plain insert is not that much work and should return 
almost instantly.

It might be due to some locking issues, but you didn't mention accessing the 
db from multiple processes / threads. Also, your filesystem / kernel might 
have issues (re)opening the file readwrite. You could use something like 
strace to see what exactly is happening during the delay, given that this 
tool is available on the platform, but if it isn't you could built it.

> I have not noticed this on my Windows or Linux machines (x86).

Me neither.

> Is this possibly because of not using transactions?

Not likely.

> The device is storing the database on a hard-disk, so it shouldn't
> have to do with paged RAM or something.

I wouldn't jump to the same conclusion when it was anything else than a simple 
insert.., but anyway. The only additional thing that comes to mind is 
that you were seeing a select coming from cache and that the insert triggered 
a powerup of the drive..? Again, something like strace could tell you 
what's happening.

> Thanks for any suggestions, and thanks again for the good instructions!

You're welcome, good luck !




-- 
Best,




Frank.


Re: [sqlite] How to cross compile sqlite-3.2.7 for arm9 s3c2410?

2005-09-28 Thread Ron Aaron

On Tue, September 27, 2005 7:39, Frank van Vugt said:

> There's some info in the wiki on it, but basically the steps are:

Hello, Frank -

I successfully created an ARM sqlite3 (3.2.7) and it is running on my Archos
PMA400 - thanks!

I have noticed that when I create a database and do a simple INSERT, (using
the sqlite3 binary), there is an appreciable delay (1-2 seconds) before
sqlite3 returns to the prompt.  When doing SELECT there is no delay.

I have not noticed this on my Windows or Linux machines (x86).

Is this possibly because of not using transactions?  It seems a bit extreme. 
The device is storing the database on a hard-disk, so it shouldn't have to do
with paged RAM or something.

Thanks for any suggestions, and thanks again for the good instructions!

-- 
Reva Forth for Linux and Windows --  http://ronware.org/reva/
GPG key fingerprint: 8130 734C 69A3 6542 0853 CB42 3ECF 9259 AD29 415D




Re: [sqlite] How to cross compile sqlite-3.2.7 for arm9 s3c2410?

2005-09-27 Thread Frank van Vugt
> I have downloaded sqlite-3.2.7.tar.gz from Internet, but I do not know how
> to compile it on s3c2410(linux 2.6, arm9, samsung)?

There's some info in the wiki on it, but basically the steps are:

1. change the configure script (see attached patch for 3.2.6)

2. configure with something like this (in my case an arm sa1110):
cd $PATH/sqlite-3.2.6
CC=arm-sa1100-linux-gnu-gcc CXX=arm-sa1100-linux-gnu-g++ \
CFLAGS=-I$TOOLCHAIN_BASE/include BUILD_CC=gcc \
./configure --host=i686-pc-linux --target=arm-sa1100-linux \
 --disable-shared --disable-tcl --prefix=$PATH_INSTALL

3. change the Makefile a bit, setting 'BCC' to your regular compiler and (if 
you want) add the static build flag, for example doing something like this:
mv Makefile Makefile.sed
cat Makefile.sed | sed 's/^BCC.*/BCC = gcc/' | sed 's/^LTLINK.*/& 
-all-static/' > Makefile
rm Makefile.sed

4. make && make install


Mind you, depending on which core you have and whether you want floating 
point, you might find the other patch attached usefull as well. It is from an 
earlier posting of myself:

"In order to wrap this up: apparently there's a feature / bug (choose one) in 
any ARM core earlier than v5 due to which a float will be stored in big 
endian quad order. The processor in this particular case is an SA1110, which 
is default little endian while having a v4 core. (and thus is 'swapping' 
the quads)."



-- 
Best,




Frank.
--- configure_orig	2005-09-19 10:46:30.0 +0200
+++ configure	2005-09-19 10:46:34.0 +0200
@@ -19209,11 +19209,11 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-  if test "$cross_compiling" = "yes"; then
-{ { echo "$as_me:$LINENO: error: unable to find a compiler for building build tools" >&5
-echo "$as_me: error: unable to find a compiler for building build tools" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
+#  if test "$cross_compiling" = "yes"; then
+#{ { echo "$as_me:$LINENO: error: unable to find a compiler for building build tools" >&5
+#echo "$as_me: error: unable to find a compiler for building build tools" >&2;}
+#   { (exit 1); exit 1; }; }
+#  fi
   BUILD_CC=$CC
   default_build_cflags=$CFLAGS
 else
@@ -20165,11 +20165,11 @@
 echo $ECHO_N "checking for $dir/include/readline.h... $ECHO_C" >&6
 if eval "test \"\${$as_ac_File+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
+#else
+#  test "$cross_compiling" = yes &&
+#  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+#   { (exit 1); exit 1; }; }
 if test -r "$dir/include/readline.h"; then
   eval "$as_ac_File=yes"
 else
@@ -20191,11 +20191,11 @@
 echo $ECHO_N "checking for $dir/include/readline/readline.h... $ECHO_C" >&6
 if eval "test \"\${$as_ac_File+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
+#else
+#  test "$cross_compiling" = yes &&
+#  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+#   { (exit 1); exit 1; }; }
 if test -r "$dir/include/readline/readline.h"; then
   eval "$as_ac_File=yes"
 else
--- vdbeaux.c_orig	2005-09-17 19:48:56.0 +0200
+++ vdbeaux.c	2005-09-19 10:55:50.0 +0200
@@ -1509,7 +1509,11 @@
 }
 len = i = sqlite3VdbeSerialTypeLen(serial_type);
 while( i-- ){
-  buf[i] = (v&0xFF);
+  if( serial_type==7 ){
+buf[(i+4)%8] = (v&0xFF);
+  }else{
+buf[i] = (v&0xFF);
+  }
   v >>= 8;
 }
 return len;
@@ -1568,28 +1572,20 @@
   pMem->flags = MEM_Int;
   return 6;
 }
-case 6:   /* 8-byte signed integer */
+case 6: { /* 8-byte signed integer */
+   u64 x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+   u32 y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
+   x = (x<<32) | y;
+  pMem->i = *(i64*)
+  pMem->flags = MEM_Int;
+  return 8;
+}
 case 7: { /* IEEE floating point */
-  u64 x;
-  u32 y;
-#ifndef NDEBUG
-  /* Verify that integers and floating point values use the same
-  ** byte order.  The byte order differs on some (broken) architectures.
-  */
-  static const u64 t1 = ((u64)0x3ff0)<<32;
-  assert( 1.0==*(double*) );
-#endif
-
-  x = (buf[0]<<24) | 

[sqlite] How to cross compile sqlite-3.2.7 for arm9 s3c2410?

2005-09-27 Thread cupidsd
I have downloaded sqlite-3.2.7.tar.gz from Internet, but I do not know how to 
compile it on s3c2410(linux 2.6, arm9, samsung)?

There is no useful tips in README or INSTALL, pls help me.

Thx.

--
我现在使用Sogou.com的2G邮箱了,你也来试试吧! 
http://mail.sogou.com/recommend/sogoumail_invite_reg1.jsp?from=sogouinvitation_EMAIL=cupidsd%40sogou.com=sqlite-users=sqlite-users=sqlite-users%40sqlite.org=fcd64dc521a05fbe8f224ceef58ce291