Yes, Arc's primary targets are webapps and prototypes. But I don't only write webapps and don't want to rewrite my prototypes in another language once they work fine but are too slow : * I have better things to do
* I will probably have to add new features later on, and Arc is especially good at that.
Thus, I was thinking about optimizing a little the arc interpreter. As Paul suggested in an old post, I looked at the code the ac function in ac.scm generates. ac is the function that translates a form in Arc in its mzscheme counterpart.Well, the sad truth is that, for example, something as trivial as the list function becomes, once expanded (this is still arc code) : ((fn () (sref sig (quote args) (quote list)) (if (is (type (quote " Creates a list from the given parameters.\n See also [[cons]] [[acons]] ")) (quote string)) (sref help (quote (fn " Creates a list from the given parameters.\n See also [[cons]] [[acons]] ")) (quote list)) (sref help (quote (fn nil)) (quote list))) (sref source-file current-load-file (quote list)) (safeset list (fn args " Creates a list from the given parameters.\n See also [[cons]] [[acons]] " args)))) And its scheme translation is ((lambda () (ar-funcall3 _sref _sig (quote args) (quote list)) (if (not (ar-false? (ar-funcall2 _is (ar-funcall1 _type (quote " Creates a list from the given parameters.\n See also [[cons]] [[acons]] ")) (quote string)))) (ar-funcall3 _sref _help (quote (fn " Creates a list from the given parameters.\n See also [[cons]] [[acons]] " . nil)) (quote list)) (ar-funcall3 _sref _help (quote (fn nil . nil)) (quote list))) (ar-funcall3 _sref _source-file _current-load-file (quote list)) ((lambda () (if (not (ar-false? (ar-funcall1 _bound (quote list)))) ((lambda () (ar-funcall1 _disp "* redefining ") (ar-funcall1 _disp (quote list)) (ar-funcall1 _writec #\newline))) (quote nil)) (begin (let ((| list| (lambda args " Creates a list from the given parameters.\n See also [[cons]] [[acons]] " args))) (namespace-set-variable-value! (quote _list) (lambda args " Creates a list from the given parameters.\n See also [[cons]] [[acons]] " args) #t arc-ns) | list|)))))) Argh. Quite a few things to optimize there (I am quite surprised, for example, to see that the docstring is repeated so many times. Even without it, it's quite a big form). Guess why it takes so long before you get the arc prompt ? In the same vein as arc-exe.scm I wrote a few days ago, I wanted to make an arc compiler, something transforming arc code in its scheme equivalent, then compiling it through the mzc utility, at least for the arc.arc and libs.arc files. Well, it's far to be easy. Has anybody tried to do such a thing as optimizing these things yet ? Have you got any idea about how we could get that better ? Do you think it will only bring a minor optimization ? |