Viewing a single comment thread. View all comments

Limenoodle_ t1_ivxksli wrote

Is there a reason why it has to load every time? Instead of already having the numbers/emojies stored somewhere?

20

Barnocious t1_ivxl1l6 wrote

Numbers and countries most likely in a cloud mpp database. The load time is due to the api running a query. This is a really great example of embedded analytics!!

14

fearatomato t1_ivyrsd4 wrote

is it a great example because it's really slow?

8

nothxshadow t1_ivyzrcp wrote

this. People forgot how to make good websites. Nothing is slower than javascript shit that queries a database for every little thing.

7

fearatomato t1_ivzoupk wrote

yeah it's only about 1kb data total for every country combined there's no reason you should have multi second loading times every single time

3

hcrx OP t1_ivxl2wd wrote

Good question! This is done on a spreadsheet with a table with the energy breakdown by source per country. Then it builds the emoji table when the country changes.

Having one build emoji table per country would be way too heavy, that’s why.

4

ztbwl t1_iw20pgd wrote

You have 8 numbers (for each energy source) per country - let's say it's a 64 bit number. There is a total of 195 countries on earth.

That's a total weight of about 12.5 KB.

Didn't want to rant, interesting solution though, was fun to discover - but the load times could be better.

1

hcrx OP t1_iw2ae03 wrote

It’s true, it should be faster. The backend of this is a spreadsheet (so is the FE) so it’s a bunch of Vlookups together to create grid.

1