[erlang-questions] Efficiency of qlc
Håkan Mattsson
hm@REDACTED
Tue Nov 20 11:52:09 CET 2012
Just FYI. There is an (old) master thesis about making an SQL compiler
for Mnesia:
http://http://www.erlang.se/publications/xjobb/sql_compiler_report.pdf
/Håkan
On Tue, Nov 20, 2012 at 3:18 AM, Solomon <solomon.wzs@REDACTED> wrote:
> I want to wirte a sql compiler for mnesia, so I need to dynamic compile the
> query string by qlc:string_to_handle/1, but it is much slower than native
> code. And I found that:
>
> code 1:
> qlc:string_to_handle("[X||X<-[1,2,3]].")
> return:
> {qlc_handle,{qlc_lc,#Fun<erl_eval.20.82930912>,
> {qlc_opt,false,false,-1,any,[],any,524288,allowed}}}
>
> code 2:
> qlc:q([X||X<-[1,2,3]])
> return:
> {qlc_handle,{qlc_lc,#Fun<my_module.0.234232>,
> {qlc_opt,false,false,-1,any,[],any,524288,allowed}}}
>
> so I think the reason is that: code 1 run by erl_eval, it scan and parser
> the code every time, and code 2 by beam, so code 1 was much slower than code
> 2.
> Is there any method to solve this problem?
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list