Hacker News new | ask | show | jobs
by mozumder 3524 days ago
So, I made a Django site with a VanillaJS single-page app framework (no React/Redux) and that includes Django server-rendered fastboot, in about 10KB Javascript code. I made it/use it for our fashion site - https://www.futureclaw.com

Page load times are about .5 seconds for me, with lots of graphics. Also, I'm pretty sure it's faster than React.

Is this something people want to use that I should package up into its own product? It's a little bit of code but mostly methodology discipline.

2 comments

I wouldn't mind taking a look. I prefer VanillaJS.

I'm currently using .Net/Java/C++ (yeah...) and am wanting to get away from that and switch to Python full time. So, I have been looking at as much Python code as I can lately.

I haven't documented/posted the JS code anywhere yet, but I did post some of the python server code on the Django developer mailing list at: https://groups.google.com/forum/#!topic/django-developers/q-...

The JS code is still being changed around.

The key here to maintain state consistency between front-end and back-end is that I transfer state from client to server via "data-model" HTML attributes. These attributes also guides the router.

Thanks. I'll go check that out when I get a break.
It's always interesting to see how someone elses tackles something. Personally I'd probably have used Pjax or intercooler.js for that. I assume the ajax-ey part is simply to avoid full page reloads and improve the general speed? Other than that it's fairly static content?

(would be interesting to compare the performance of this vs static site generator output on a really fast CDN - my hunch would be that this would probably win unless you were at a geographic disadvantage)

It's static content (for now... the site is being designed for user-generated content.), but page generation times without caching is about 1-2ms (3-7ms with gzip), and I'm actually speeding that further with materialized database views, probably down to 500us. With Redis caching it's in the 350us range. Those are latency numbers. So, it's about as fast as it gets.

Note that I don't use the Django Templating system at all, and generate pages in Python instead.

I already went through a viral moment that caused our site to go down for a day after our last issue (we're a print magazine), and so the site is being designed to work around that.