sqlite> create virtual table n using wholenumber;
sqlite> .timer on
sqlite> select sum(sqrt(value)) from n where value between 1 and 1000;
21097.4558874807
Run Time: real 0.001 user 0.000000 sys 0.000000
sqlite> select sum(sqrt(value)) from n where value between 1 and 1000000;
666667166.458841
Run Time: real 0.160 user 0.156250 sys 0.000000
sqlite> select sum(sqrt(value)) from n where value between 1 and 1000000000;
21081851083598.4
Run Time: real 151.021 user 151.031250 sys 0.000000
sqlite> select sum(value) from n where value between 1 and 1000000000;
500000000500000000
Run Time: real 89.341 user 89.343750 sys 0.000000

A native sqrt takes about 60 ns per operation.

>-----Original Message-----
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of big stone
>Sent: Sunday, 9 March, 2014 03:35
>To: sqlite-users@sqlite.org
>Subject: Re: [sqlite] Suggestion to add "locate" as a broader version of
>"instr"
>
>Hello Max,
>
>Your link is pretty interesting. It looks that :
>- method1 should be easily implemented with SQLite "floating point"
>representation,
>- and with a very very small code size.
>
>Here is the benchmarking of the two available methods :
>
>https://raw.github.com/stonebig/ztest_donotuse/master/square_rooting_benc
>hmark.GIF
>
>
>So :
>- your method is only 3 times slower than the python sqrt(),
>- if SQLite team accepts to sacrifice a few bytes to implement sqrt(), we
>may benefit a  389% speed-up (300/27*.652/1.86) at least.
>    (300/27*.652/1.86)
>
>sqrt() is very interesting for statistics on-the-go over sql datas.
>
>Regards,
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to