if I refresh the browser, the program is very fast.

it seems to happen to the first time.

On Tuesday, March 28, 2017 at 5:57:39 PM UTC-7, Bill Yan wrote:
>
> the native build is instant.
>
> I'm using -O3 even. (started with -O2.)
>
> will try profiler
>
> On Tuesday, March 28, 2017 at 5:53:10 PM UTC-7, Alon Zakai wrote:
>>
>> Is 6 minutes similar to what you see in a native build? If it's more than 
>> 2x slower then something may be wrong. Make sure it's optimized (-O2 or 
>> above during "link"), and if that's not it, use a browser profiler (on a 
>> --profiling build) to see what's going on.
>>
>> Otherwise, there is a way to add pauses like that, but at a cost, see the 
>> emterpreter 
>> https://github.com/kripken/emscripten/wiki/Emterpreter#emterpreter-async-run-synchronous-code
>>
>> Another approach is to split up the code running during startup, here is 
>> an example of splitting up main() into pieces, 
>> https://github.com/kripken/BananaBread/blob/master/cube2/src/engine/main.cpp#L1156
>>
>> On Tue, Mar 28, 2017 at 5:47 PM, Bill Yan <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I just tried emscripten/wasm today.
>>>
>>> My code is an opengl/sdl program. I have a setup routine that 
>>> pregenerates models and textures. And then a render loop.
>>>
>>> I learnt from the document that I can't use a plain while() loop for the 
>>> main loop as it will stuck the web browser.
>>>
>>> But my setup function seems to take quit long time too, about 6 minutes.
>>>
>>> Eventually the program will run perfectly when it reaches the main loop. 
>>> but the 6 minutes setup time is unacceptable.
>>>
>>> I'm wondering if there is a way to briefly give the control back to the 
>>> browser during setup.
>>>
>>> For example, a pause function. so I can do
>>>
>>>
>>> setupStep1();
>>> pause();
>>> setupStep2();
>>> pause();
>>> ....
>>>
>>>
>>>
>>> Thanks!
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to