Hacker News new | past | comments | ask | show | jobs | submit login

Huh. I wonder what the start time is on the language I'm using for CGI work. (I'm using CHICKEN, which is a compiled Scheme R5RS implementation with numerous extensions).



Probably fine for some things, since it is compiled, and, as I understand it is pretty fast. I don't know a lot about the internals of chicken, but since it's a Scheme wouldn't it need some kind of VM for macros and memory management and such? That'd impose some kind of startup overhead that C wouldn't have. But, then again, Perl can start fast enough for some things (though most Perl web app developers use some sort of app server, because they rely on a bunch of libraries that would increase startup time remarkably if it had to happen for every request).

Do you write command line apps with CHICKEN? Are they super fast to start, like instant (comparable to something written in C or small Perl scripts)? If so, then CGI could probably be fast enough for some use cases. If you can perceive the startup time, then no, it'd be kinda sucky when used with CGI.


For what it's worth, SBCL (which essentially in all ways completely unrelated to chicken other than them both being native compiled dynamic languages) can startup a minimal runtime and exit in 3.8ms on my system. it goes up to about 5ms for a moderate sized application (which includes some dynamically linked libraries that must be loaded).

on the same system:

/bin/true starts up in 0.5ms

/usr/bin/env perl starts up in 2.4ms

/usr/bin/perl starts up in 1.8ms

If you want to run your own benchmarks, just use time and something like this small program (I ran with 1000 iterations):

    #include <sys/types.h>
    #include <sys/wait.h>
    #include <stdlib.h>
    #include <unistd.h>
    
    int main(int argc, char *argv[])
    {
        int i;
        int iter=atoi(argv[1]);
        for(i=0;i<iter;++i) {
            pid_t pid=fork();
            if(pid) {
                waitpid(pid,NULL,0);
            }
            else {
                execl(argv[2],argv[2],NULL);
            }
        }
        return 0;
    }


>wouldn't it need some kind of VM for macros and memory management and such?

Not a VM: it's compiled. It needs to bind to libchicken, and it needs to do some things that native C programs wouldn't.

Also, you wouldn't need a VM for macros: they're a compile-time feature, and don't even exist at runtime.

Yeah, it's not humanly noticable.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: