Giter Site home page Giter Site logo

Optimizing startup time about nicegui HOT 5 CLOSED

me21 avatar me21 commented on May 17, 2024
Optimizing startup time

from nicegui.

Comments (5)

me21 avatar me21 commented on May 17, 2024 1

I'll try to run your code, but I think MacBook is much more powerful than Beaglebone Black, so maybe it's not noticeable there.
I'll update this issue later.

from nicegui.

falkoschindler avatar falkoschindler commented on May 17, 2024

I'm having trouble reproducing your result. The following code measures the time from starting the script until the UI is running. Independent of whether LinePlot and Plot are imported in ui.py, the time is always around 1.4s on my MacBook. Maybe it's an issue with Matplotlib on different processor architectures. Or I misunderstood something.

import time
t = time.time()

from nicegui import ui

ui.label('Hello world!')

ui.on_startup(lambda: print(f'{time.time() - t:.3f}'))

ui.run(port=1234)

from nicegui.

me21 avatar me21 commented on May 17, 2024

With commented imports:

debian@beaglebone:~$ web_env/bin/python nicegui_test.py
/home/debian/web_env/lib/python3.7/site-packages/justpy
Module directory: /home/debian/web_env/lib/python3.7/site-packages/justpy, Application directory: /home/debian
JustPy ready to go on http://0.0.0.0:1234
14.747

With uncommented imports:

debian@beaglebone:~$ web_env/bin/python nicegui_test.py
/home/debian/web_env/lib/python3.7/site-packages/justpy
Module directory: /home/debian/web_env/lib/python3.7/site-packages/justpy, Application directory: /home/debian
JustPy ready to go on http://0.0.0.0:1234
37.066

In my research, I ran python interpreter with -X importtime flag to generate import statements timings. And viewed it with tuna tool. But the results are the same, nicegui is much slower on Beaglebone Black with plot imports.

from nicegui.

falkoschindler avatar falkoschindler commented on May 17, 2024

Ok, we checked the timing on a Jetson Nano and got 4.0 seconds each. The large difference might be caused by the little RAM you have available on the Beaglebone Black.

Nevertheless, we will shortly implement feature flags for things like Matplotlib, Highcharts, AG Grid and Three.js.

from nicegui.

falkoschindler avatar falkoschindler commented on May 17, 2024

Ok, it is finally released as v0.7.29

from nicegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.