One thing that occures to me, is that bash is cheeting. Bash actually
takes longer than that to load to memory, but because it is already
running on your system, on linux at least, the new bash process shares
executable memory with the old bash processes. Factor probably loads
everything to DATA sections of memory (which are read-write) and
therefore linux cannot share all of that effort that has gone into
loading the factor process. I'm not an expert on how this works, so
please don't yell at me if I'm wrong ;). Have you tried loading the
factor interpreter in the background and seeing if factor launches
quicker while another factor process is running?


On 02/01/2017 16:31, pet...@riseup.net wrote:
> On 2017-02-01 15:16, John Benediktsson wrote:
>> I did that and it's not a huge amount, maybe 10-20%. We need to
>> profile and see what else it's doing. Like I said, low hanging fruit
>> are aplenty.
>>
>>
>>> On Feb 1, 2017, at 12:37 AM, pet...@riseup.net wrote:
>>>
>>>> On 2017-02-01 00:19, John Benediktsson wrote:
>>>> Part of the startup time is calling all of our "startup hooks", of
>>>> which I
>>>> have 35 right now in my Factor instance, in all of these 
>>>> vocabularies:
>>>>
>>>> {
>>>>    "alien"
>>>>    "destructors"
>>>>    "alien.strings"
>>>>    "io.backend"
>>>>    "source-files.errors"
>>>>    "compiler.units"
>>>>    "vocabs"
>>>>    "io.files"
>>>>    "vocabs.loader"
>>>>    "command-line"
>>>>    "threads"
>>>>    "cpu.x86.features"
>>>>    "io.thread"
>>>>    "core-foundation.run-loop"
>>>>    "environment"
>>>>    "io.backend.unix:signal-pipe-thread"
>>>>    "io.launcher"
>>>>    "random.unix"
>>>>    "bootstrap.random"
>>>>    "io.sockets:ipv6-supported?"
>>>>    "openssl"
>>>>    "tools.crossref"
>>>>    "cocoa"
>>>>    "io.files.temp"
>>>>    "tools.deprecation"
>>>>    "core-foundation"
>>>>    "vocabs.cache"
>>>>    "vocabs.refresh.monitor"
>>>>    "opengl.gl"
>>>>    "opengl"
>>>>    "ui"
>>>>    "core-text.fonts"
>>>>    "core-text"
>>>>    "tools.errors.model"
>>>>    "ui.tools.error-list"
>>>> }
>>>>
>>>> I'm sure a lot of that could be delayed in smart ways to make startup
>>>> time
>>>> faster, that's what I meant by low hanging fruit, but also not
>>>> something
>>>> that anyone is working on right now.
>>>>
>>>> Best,
>>>> John.
>>>>
>>>>> On Mon, Jan 30, 2017 at 12:40 PM, <pet...@riseup.net> wrote:
>>>>>
>>>>>> On 2017-01-30 18:14, Timothy Hobbs wrote:
>>>>>> If you are on linux, you might try this very new feature:
>>>>>> https://criu.org/Main_Page
>>>>>>
>>>>>>> On 01/30/2017 17:29, Jim Mack wrote:
>>>>>>> You could also set up factor as a local web server, and send bash
>>>>>>> requests to it through a web page, and it would be able to 
>>>>>>> accomplish
>>>>>>> them locally (or remotely) and report you the results.  It would 
>>>>>>> be a
>>>>>>> quick round-trip cycle with great feedback and the ability to 
>>>>>>> bookmark
>>>>>>> commands.
>>>>>>>
>>>>>>> On Sun, Jan 29, 2017 at 1:39 PM, <pet...@riseup.net
>>>>>>> <mailto:pet...@riseup.net>> wrote:
>>>>>>>
>>>>>>>>    On 2017-01-29 16:20, John Benediktsson wrote:
>>>>>>>> It would be nice to improve startup time. I imagine some low
>>>>>>> hanging
>>>>>>>> fruits if we looked deeply into it. I'll make a note to get that
>>>>>>>    on my
>>>>>>>> list, unless someone looks into it sooner.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Jan 28, 2017, at 2:25 PM, pet...@riseup.net
>>>>>>>    <mailto:pet...@riseup.net> wrote:
>>>>>>>>> I spend a lot of time writing small scripts, often in bash.
>>>>>>> That is
>>>>>>>>> becoming a more and more painful task as bash is a nice-enough
>>>>>>>>> language
>>>>>>>>> on the first look but in the end it seems to go out of it's way
>>>>>>> to
>>>>>>>>> trip
>>>>>>>>> you up with every character you type. I don't mean to rant, I
>>>>>>> know
>>>>>>>>> it's
>>>>>>>>> an old language that has to keep a lot of backward
>>>>>>>    compatibility and
>>>>>>>>> it
>>>>>>>>> actually still serves very well for what it was designed for,
>>>>>>>    as long
>>>>>>>>> as
>>>>>>>>> your script stays <100 lines. Still, there's a lot to be
>>>>>>> desired.
>>>>>>>>> Factor is a cool language, it's very expressive, mature, has a
>>>>>>>    lot of
>>>>>>>>> libraries and has all sorts of tricks up its sleaves to bend it
>>>>>>> to
>>>>>>>>> your
>>>>>>>>> will (much like lisp in that regard). It would be a fun
>>>>>>>    experiment to
>>>>>>>>> write a library or EDSL (embedded DSL) for bash-like scripting.
>>>>>>>>> However
>>>>>>>>> there's a bone to be picked:
>>>>>>>>>
>>>>>>>>> $ time bash -c ''
>>>>>>>>> bash -c ''  0.00s user 0.00s system 94% cpu 0.004 total
>>>>>>>>>
>>>>>>>>> $ time factor-vm -e=''
>>>>>>>>> factor-vm -e=''  0.12s user 0.05s system 99% cpu 0.178 total
>>>>>>>>>
>>>>>>>>> I know one can create a custom image and maybe cut down on the
>>>>>>>    startup
>>>>>>>>> a
>>>>>>>>> bit, but my question is - would it be possible to cut it down
>>>>>>> to
>>>>>>>>> bash's
>>>>>>>>> startup time *and* still have all the necessary vocabularies in
>>>>>>>    it? I
>>>>>>>>> don't want to know the startup time with a small image that has
>>>>>>>    like
>>>>>>>>> nothing in it, I can quickly test that myself. I'd need help to
>>>>>>>    answer
>>>>>>>>> -
>>>>>>>>> if you imagine the use case I'm talking about, include all the
>>>>>>>    vocabs
>>>>>>>>> that use case would need and make all other possible
>>>>>>>    optimizations (if
>>>>>>>>> there are) without sacrificing too much, can the startup reach
>>>>>>>    similar
>>>>>>>>> times?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> ------------
>>>>>>>>>  Peter Nagy
>>>>>>>>> ------------
>>>>>>>>>
>>>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>>>>>> 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
>>>>>>>    <mailto:Factor-talk@lists.sourceforge.net>
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>>>>    <https://lists.sourceforge.net/lists/listinfo/factor-talk>
>>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>>>>> 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
>>>>>>>    <mailto:Factor-talk@lists.sourceforge.net>
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>>>>    <https://lists.sourceforge.net/lists/listinfo/factor-talk>
>>>>>>>
>>>>>>>    Hi John,
>>>>>>>
>>>>>>>    you think you can reach similar startup times? That would be
>>>>>>> really
>>>>>>>    cool. I guess your todo list is rather long though.
>>>>>>>
>>>>>>>    As a side note, are there other concatenative languages you 
>>>>>>> know I
>>>>>>>    could
>>>>>>>    look at?
>>>>>>>
>>>>>>>    --
>>>>>>>    ------------
>>>>>>>       Peter Nagy
>>>>>>>    ------------
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>>>>    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
>>>>>>>    <mailto:Factor-talk@lists.sourceforge.net>
>>>>>>>    https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>>>>    <https://lists.sourceforge.net/lists/listinfo/factor-talk>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>>>> 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
>>>>>>
>>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>>> 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
>>>>> Thanks for the interesting links/ideas :)
>>>>>
>>>>> --
>>>>> ------------
>>>>>   Peter Nagy
>>>>> ------------
>>>>>
>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>> 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
>>>>>
>>>> ------------------------------------------------------------------------------
>>>> 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
>>> Is there any dumb way for me to test what would the startup time be 
>>> have
>>> I removed all the hooks? That would show what is the actual overhead 
>>> all
>>> the hooks bring.
>>>
>>> --
>>> ------------
>>>   Peter Nagy
>>> ------------
>>>
>>> ------------------------------------------------------------------------------
>>> 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
>> ------------------------------------------------------------------------------
>> 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
> I would consider contributing if you tell me the startup time can be cut 
> down to 5% of the current one :) That would make the runtime usable for 
> short scripts in shell pipelines and such.
>


------------------------------------------------------------------------------
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