Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow to generate application.js #189

Closed
qume opened this issue Aug 27, 2021 · 7 comments · Fixed by #190
Closed

Slow to generate application.js #189

qume opened this issue Aug 27, 2021 · 7 comments · Fixed by #190
Assignees
Milestone

Comments

@qume
Copy link

qume commented Aug 27, 2021

When I launch smashing, the first request takes around 30 seconds. It looks like this is when it generates application.js.

Is this normal and expected, and if so are there any known ways to cache and/or speed this up. Restarting the server to re-read jobs scripts makes development slow. I realise I could move jobs out of smashing and have them push data in via the API, but wanted to check first others experiences.

Running Ubuntu 18 on Jetson Xavier NX

@qume qume added the bug label Aug 27, 2021
@qume
Copy link
Author

qume commented Aug 27, 2021

Apologies for the 'bug' label - it seems to have added it automatically and I can't seem to remove it.

@kinow kinow added the question label Sep 2, 2021
@kinow
Copy link
Member

kinow commented Sep 2, 2021

Apologies for the 'bug' label - it seems to have added it automatically and I can't seem to remove it.

Not a problem. let's leave the bug, but add a question too.

@kinow
Copy link
Member

kinow commented Sep 2, 2021

With Rails we could simply ask it to precompile the assets for us. But I couldn't find a solution for our Sinatra+sprockets.

Sprockets will process the assets in our javascripts (and others) and combine them, creating an application.js file on the fly. But apparently it took a long time on your environment.

I tried this quick script:

# original: https://stackoverflow.com/a/13863492
require "sprockets"
require "dashing"


assets = Sprockets::Environment.new
assets.append_path File.join(Gem.loaded_specs['smashing'].full_gem_path, 'javascripts')
assets.append_path "assets/javascripts"

task :assets do
    assets["application.js"].write_to "assets/javascripts/application.js"
end

And rake assets produces the application.js but I think I didn't create the sprockets environment correctly. But I think that's the idea, to compile the assets for your dashboard once, and after that the startup time should improve 🤞

@qume
Copy link
Author

qume commented Sep 3, 2021

Great thanks that's definitely a step in the right direction. It ran without errors, and the application.js it generated looks sensible.

However it doesn't display anything, and it's friday evening here, so will have a look next week. Hopefully something simple.

I'm using this as a UI for an embedded device (with minor changes to make tiles clickable), so my off-label use case probably doesn't fit with what the project is designed for. It works great for it though.

@kinow kinow added this to the 1.3.5 milestone Sep 5, 2021
@kinow
Copy link
Member

kinow commented Sep 5, 2021

@qume could you test with the Rakefile from this PR, please? #190

Feel free to approve the PR if that works for you :-) when merged, future versions of Smashing will include a Rakefile with the generated dashboard project (i.e. smashing new test will have test/Rakefile) that can be used to produce the precompiled application.js. Not generating application.css for now, but we could do that too if it's slow to compile it.

Thanks
Bruno

@kinow kinow self-assigned this Sep 5, 2021
@kinow kinow closed this as completed in #190 Sep 9, 2021
@kinow
Copy link
Member

kinow commented Sep 9, 2021

@qume,

on Jetson Xavier NX

Hijacking this issue for a quick question. Really interesting you used this board/computer. Hadn't heard about it. Looks like a raspberry pi, but with a GPU?

Does it work well (not only for Smashing)? I have a very old Thinkpad that I don't have plans for replacing. But I've been using Blender, and due to my old GPU and its Cuda version, I'm rendering everything with my CPU.

I've been reading about external GPU's and cloud rendering farms as alternatives, but now I'm wondering if I could perhaps use one of these AI/ML computers instead?

Thanks!
Bruno

@kinow kinow modified the milestones: 1.3.5, 1.3.6 Sep 9, 2021
@qume
Copy link
Author

qume commented Sep 9, 2021

It looks like you're in Auckland. Send me your postal address to luke@reid.org.nz and I'll send you one. I'm using the Xavier NX because I needed a bit more horsepower, and I have a Jetson Nano here you can have.

They work well. Nvidia can be slightly frustrating on the software side, but if you want something small with a bunch of Cuda they are great. Like you say, essentially a Raspberry Pi but with GPU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants