On Thu, Jan 19, 2017 at 12:20 AM, Oleg wrote: > > > Have you ever designed at length how to implement a super fast > > *interpreted* version of metaocaml, or let me put it this way: do you > > think if that is possible at all? > > I guess you are asking about the complexity and overhead of building > code representations (because otherwise, MetaOCaml is an ordinary > OCaml program, and could be optimized as such). Code values have a > somewhat complex representation because they also describe all > future-stage free variables that occur within the value. The data > structure used to represent free variable is designed to be > efficient. Long time ago I did a spot test of generating code with 100 > free variables. I could not detect any overhead due to the handling of > free variables. Thus in my experience, MetaOCaml-specific overhead is > rather negligible. If there is a real need to get MetaOCaml to generate > code as fast as possible, one should optimize MetaOCaml as any other > OCaml program. Yes, I might also be asking about the complexity of designing an extremely fast / ideal runtime system. [Ocaml's bytecode and interpreter is nice, but it is not quite what I would do. Anyhow, that's off-topic.] I'm glad to hear there isn't major overhead with free variables, that would be a potential bottleneck. That's quite nice and encouraging. > > You may also be asking about the performance of Runcode.run. It > includes compiling the code and running the resulting > bytecode. Compilation does impose overhead. How to reduce it is a > complex question. For now I remark that the generated code is usually > rather simple. One could compile it with rather old version of OCaml, > which was really fast. > I did think at length on how to do that with code generated on the fly. It seemed like there is some unavoidable costs associated with the usual, like type-checking of course. I had considered metaocaml for my AGI codebase once, now I will think again, thanks for your remarks. My code is written in ocaml, so I do try to evaluate every significant ocaml technology developed. Let's stay at the cutting edge, and many thanks for your awesome contributions again! https://github.com/metaocaml/ber-metaocaml/blob/ber-n104/metalib/runcode.ml Celebrating Oleg's cyber poetry here ^_^ Best, -- Eray Ozkural, PhD. Computer Scientist Founder, Gok Us Sibernetik Ar&Ge Ltd. http://groups.yahoo.com/group/ai-philosophy