Lurker News

Comments (102) 48 threads

leeoniya11 replies#
Unfortunately, I have to use Google Analytics and Google Ads at work every day, and these UIs have absolutely terrible performance :(

A small part of the problem is drawing the trend charts. So I decided to make uPlot [1] to see what was really possible.
[1] https://github.com/leeoniya/uPlot

hardwaresofton1 reply#
Hopefully the upvotes and being on the front page is enough, but if not just want to say props, this is amazing. Already had it saved in my bookmarks glad to see it pop up again :)
leeoniya#
thanks!
contravariant1 reply#
Honestly the title doesn't do it justice. For a plotting tool it's not an impossible task, but making a webpage this responsive is incredibly hard, so well done there.
leeoniya#
it's an understatement for sure :)

a lot of time is spent on just DOM layout and JITing the JS, which get amortized with huge datasets. the 166k bench doesnt take any longer.

doublesCs1 reply#
Hi, I'm very interested in this. I've been using dask/plotly for a side project but it's just too slow. If you know dask, do you think you could discuss which features of dask your project has and doesn't have?
vamega1 reply#
I don't think that actually plots the 40M points, just aggregates them in Python and plots a small section of that data on the website?

Continue this thread — 1 reply

gesman3 replies#
It plots cell towers in the middle of my residential neighborhood where i absolutely sure there aren't any

Continue this thread — 3 replies

hardlianotion#
That's rather beautiful.
simmers#
Kudos for directing folks to other projects if uPlot isn't fast enough for them. Every developer should take the time to write out appropriate and inappropriate use-cases on the readme.
adeelk93#
I like this a lot! Reminds me of dygraphs, and then I saw it in that in the acknowledgements :)
jedberg#
This is fantastic and may solve a real problem for me. Thank you so much, and thank you for the MIT license!
maxwellg1 reply#
The 166k benchmark is ridiculously snappy. Could you shave off a few more ms by inlining the JSON as a data block?
leeoniya#
probably, but something about diminishing returns...:p
chrissnell#
This is awesome. I wrote some software to pull readings off my weather station and stream them to the browser. The plotting library that I use is pretty awful. Besides being slow, it's constantly hosing up the numbers on the y-axis. I want to give uPlot a shot.

Station: https://carlisleweather.com
Software: https://github.com/chrissnell/gopherwx

jrumbut#
This is just incredible.
victorthehuman#
This is a test reply please ignore it, it will be deleted in a few minutes.
fabian2k2 replies#
The 150ms benchmark in the title is really selling this short, the performance is very impressive. The 150ms seem to refer to the time it takes to initialize the graph, and with a hot cache that is more like 50ms for me here. Redrawing seems much, much faster.

I have done some visualization with WebGL because I couldn't get it fast enough with just drawing lines. That was a while ago so I'm not sure about the details, but even a simple prototype just drawing a few tens of thousands to a hundred thousand lines using canvas was slower than this for me (subjectively).
I'll have to look at the code later, but I'm curious about where this library is getting the performance from. Before I saw this I would have said you can't do this at this speed without using previously downsampled version of the data points, I'm not entirely sure now.
I'm still looking at the performance tab in the browser dev tools and how impressively empty the main Javascript usage plot is.

439202 replies#
It looks like the mouse lines and the selection highlight are just partially-transparent divs stacked on top of the canvas that get moved around, so nothing actually gets redrawn unless the date range changes (which is a pretty clever approach!).
leeoniya#
but really tricky to align correctly at different screen pixel densities and rounding errors. it's still not pixel-perfect, but i decided it was good enough.
fabian2k1 reply#
That's something I expected, you really don't want to trigger redraws on mouse over. What surprised me was that I couldn't tell the the times where I zoomed in or out from the JS flame chart. Usually that is really obvious, but in this case zooming was so fast that you could hardly see it. And this graph has probably around ~194k data points (388k in the source data, I assume that's x and y). I'm not entirely sure about the number of points here, I'm taking that from the json delivered to the site.

The selection highlight is unusual, I admit. That's something I'd just skip if I were going for high performance.

leeoniya#
> And this graph has probably around ~194k data points

no, the top graph is pretty much what the title says: 3 * 365 * 24.
but 194k is also no problem :)

krick1 reply#
Very nice project, but I just want to randomly point out that 3 years of hourly data is really not as much, as it may sound to somebody. In fact, it's 3 times less than 24 hours of every-second of data, which is pretty common scale for all sorts of real-time monitoring tools we often use. These fine-sliced stats really pile up quickly...
leeoniya#
> but I just want to randomly point out that 3 years of hourly data is really not as much, as it may sound to somebody.

you're right, it isn't. and yet many js charting libs struggle even with this.
on my i5 thinkpad with integrated gpu uPlot can render 600 series x 8,000 datapoints in ~2000ms [1]. and it finishes this job in ~7s on my 2015 sony z5 compact phone. so there's that :)
but really, pumping 4.8M datapoints into a browser is probably not a great idea. you're gonna want to aggregate on the server at some point. just sayin'.
[1] https://leeoniya.github.io/uPlot/bench/uPlot-600-series.html

zlepper1 reply#
This looks really really neat!

Just want to ask, because I love talking about render performance: have you tried doing this using offfscreen canvas? That should allow you to move a lot of things to a worker, so you avoid blocking the rendering with js? It probably won’t speed up the total time to finished render, but I assume it will lock the page for a shorter period of time?

_bxg1#
If the rendering is this controlled (and sparse), blocking the thread with it isn't really a concern. And with this data size, serialization/deserialization between the main and worker thread would probably become nontrivial.

Load more comments