It's like this. You are asking the restaurant to serve you a $1
hamburger and are getting annoyed because the chef is preparing a five
course dinner. :) It is fair to want a $1 hamburger quickly, but a
restaurant not specialized in serving them might not be able to make
one that fast.

In this case, Factor starts a whole integrated development
environment, complete with a compiler and gui, but you are just
interested in running a small script. One solution is running Factor
as a server. It's not bad, I do it all the time and IPC between Emacs
and Factor works really smooth. It could work just as well between
Factor and Bash. But if you aren't willing to accept that solution
then it is hard to solve your problem because Factor's startup time is
IO bound. E.g take a look at:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    FILE *f = fopen("/home/bjourne/pubwork/factor-orig/factor.image", "rb");
    fseek(f, 0L, SEEK_END);
    long size = ftell(f);
    fseek(f, 0L, SEEK_SET);
    char *heap = malloc(size * 3);
    fread(heap, size, 1, f);
    long chk = 0;
    for (long n = 0; n < size; n += 200) {
        chk += heap[n];
    }
    printf("%ld\n", chk);
    free(heap);
    fclose(f);
    return 0;
}

On my computer, with the factor.image file hot, running this example
takes 140 ms and ./factor -e='' 240 ms. So as you can see, reaching
Bash's startup time isn't realistic. Even an image 1/10th the size of
the standard one (118 mb) would take roughly 24 ms to load which is
still much slower than Bash.

Afaik, almost no language runtime can compile and interpret source
files nearly as fast as Bash.

2017-02-02 10:09 GMT+01:00  <pet...@riseup.net>:
> No need to apologize, as far as I'm concerned we're just discussing :)
> Now I hope I didn't sound too rude. I'm just trying to get on the same
> page with everyone. The provided solutions are in the line of "if the
> initialization is taking longer than you'd like, here's a way how to
> initialize only once". My focus is somewhere else though - why is the
> initialization taking so long? John is saying there's room for
> improvement, room to do less.
>
> --


-- 
mvh/best regards Björn Lindqvist

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to