Unable to load image

Do YOU know why the emoji picker freezes rDrama?

If you look at the code, it's because for whatever reason, the emoji loader code creates an array that maps tags to emojis... but for some reason, they decided to implement this by storing an array of tags and then binary searching that array for EVERY TAG that must be updated -- consider that each of the 5,000 some emojis have multiple tags! Plus, they create multiple DOM elements for each emoji! This code has O(m * n * log(n)) complexity, where m is the average number of tags per emoji and n is the number of emojis. This code could very simply be sped up by using a hashmap (which is builtin with JS's Map) or by doing this work on the server and saving the result, so you would send back a JSON file like

{
    "tags": {
        "marsey": ["marseylove", "marseyfemboy", ...],
        "othertag": ["emoji1", "emoji2"....]
   }
}
81
Jump in the discussion.

No email address required.

UPDATE: just realized that the boneheads who wrote the file spelled "caret" wrong

Jump in the discussion.

No email address required.

@MURDERVANN try to code challenge fail!

Jump in the discussion.

No email address required.

stop bullying me :m#arseycry:

Jump in the discussion.

No email address required.

u gotta chill with that computer shit ive been getting laid ever since i stopped

Jump in the discussion.

No email address required.

what did you start doing instead

If I chill with the computer shit I'll just be left doing drugs in my room alone

Jump in the discussion.

No email address required.

throwing car batteries in to the ocean 💯

Jump in the discussion.

No email address required.

:marse#yxdoubt:

@ScaryHodor wants you to know that white extinction is long overdue and that includes you @BWC

Jump in the discussion.

No email address required.

Thanks for the update

Jump in the discussion.

No email address required.

No problem, thanks for the chudding.

@ScaryHodor wants you to know that white extinction is long overdue and that includes you @BWC

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/16973214109506774.webp


https://i.rdrama.net/images/1707881499271494.webp https://i.rdrama.net/images/17101210991135056.webp

Jump in the discussion.

No email address required.

Reported by:

Luigi is way cooler than loser Mario any day.


![](https://files.catbox.moe/y2zrro.png)

Jump in the discussion.

No email address required.

Just get a faster computer, sweaty. If you're not running the latest i11 64 core processor with 128GB of RAM and liquid cooling that uses a small lake as a heat sink, you shouldn't expect to be able to browse the modern internet, smh.


https://i.rdrama.net/images/17092367509484937.webp https://i.rdrama.net/images/17093267613293715.webp https://i.rdrama.net/images/17151063782028813.webp

Jump in the discussion.

No email address required.

Probably unironically true for asian websites. Whenever I had the misfortune of having to visit one it felt like my PC is about to have cancer. 999 needlessly animated elements all playing at the same time

Jump in the discussion.

No email address required.

Works on my machine :marseymini:

Jump in the discussion.

No email address required.

>why am i learning about algorithms, they aren't important because computers are so fast

:#marseygigaretard:

Jump in the discussion.

No email address required.

while he was learning algorightms I was learning all marsey names so I can type them without the menu :marseybigbrain:

Jump in the discussion.

No email address required.

TFW one of the solutions still doesn't use an algorithm.

Leetcodecels btfo again

Jump in the discussion.

No email address required.

>She doesn't know how bad the old emoji picker was

:marseyboomer: *siiiiiiip* those were the days

Anyways good luck on your quest to get that capy peepee :marseyagreefast:

Jump in the discussion.

No email address required.

aevann wants you to show him your big O complexity

Jump in the discussion.

No email address required.

Lemme see that log(n) :marseynut:

Jump in the discussion.

No email address required.

You know that fixing this site for free isn't gonna make Aevann frick you right? You could just remake deuxrama.net with better performance and siphon money and users from here.

Jump in the discussion.

No email address required.

I want to believe that TB will get that affair

Jump in the discussion.

No email address required.

Wrong

Jump in the discussion.

No email address required.

NERRRRRDDDDDDDD

Jump in the discussion.

No email address required.

Couldn't replicate on my machine. ticket closed.

Jump in the discussion.

No email address required.

Well, I know now! :marsey:

Jump in the discussion.

No email address required.

Do not frick with the tags I will cry and shit and throw up I spent so long working on those

Jump in the discussion.

No email address required.

I was going to rewrite the whole JS modal file. Whether or not that actually gets finished depends if I'm getting drunk and/or railed tonight.

Jump in the discussion.

No email address required.

why not just do it on the fricking backend like u said

Jump in the discussion.

No email address required.

ugh fine I guess I am your little pogchamp. I'll write it for you bb

Jump in the discussion.

No email address required.

:#marseypass: or :#marseypass2: ?

Jump in the discussion.

No email address required.

Would it have to be rebuilt everytime an emoji is added?


:!marseybooba:

Jump in the discussion.

No email address required.

Yes. But right now its being rebuilt every time you start typing an emoji...

Jump in the discussion.

No email address required.

compute time on the client isn't actual compute time. Anyone who cares about browser performance is a little soyboy cuckold


Give me your money and I'll annoy people with it :space: https://i.rdrama.net/images/16965516366194396.webp

Jump in the discussion.

No email address required.

idk I don't have a bad computer so i never noticed


Give me your money and I'll annoy people with it :space: https://i.rdrama.net/images/16965516366194396.webp

Jump in the discussion.

No email address required.

Okay but then you would have to update it for each emoji that is added which is totally unfeasible.

It loads on my old phone with no problem so you must be using a computer from the stone age if you think something is wrong with how it works currently.

Jump in the discussion.

No email address required.

Please don't comment on coding-related stuff if you can't code. It's totally feasible and in fact more computationally efficient to do it that way.

Jump in the discussion.

No email address required.

Please don't comment on coding-related stuff if you can't code.

:marseysurejan: :marseylaugh:

It's totally feasible and in fact more computationally efficient to do it that way.

No it isn't. It's perfectly fine how it works now.

Jump in the discussion.

No email address required.

>No it isn't.

Yes it is. I could explain it to you, but I doubt you would understand.

Jump in the discussion.

No email address required.

Yes it is. I could explain it to you, but I doubt you would understand.

Yes please explain how your personal problem requires unnecessary feature bloat to the detriment of every other user on this site.

Jump in the discussion.

No email address required.

What do you mean "personal problem"? Look how long this freezes after I start typing out an emoji

Jump in the discussion.

No email address required.

Yes personal problem because this never happens that long for me you just have a slow device.

Also you didn't explain how yet.

Jump in the discussion.

No email address required.

Reported by:
  • Lappland : Too stupid? But you can't explain something?

Exiled for 1 day.

Reason: Too stupid for /h/slackernews, go back to the main feed.

Jump in the discussion.

No email address required.

You don't want to explain because you cannot. You can't justify your ideas by laying out the facts in a rational way that can challenge what I said so you have to resort to having a sperg out.

Jump in the discussion.

No email address required.

More comments

You're looking in the wrong spot. If you did a little more digging and testing, you would realize that uses of the inline emoji picker are only slow on the first use on a page.

You are correct that that is not as efficient as it could be, but the main reason it's slow on the first load is that it has to make a request to get the emoji list on each page load. Since there's no caching headers on it and it's dynamic, the browser redoes the request every time.

@Aevvan could you please add a cache header or even better an etag to the emoji list route. That should be the easiest way to fix the issue. The alternative, but probably much more work and less effective, is to save the list plus timestamp to localstorage or indexeddb and then check it daily on the coient

Jump in the discussion.

No email address required.

You are wrong. Fetching doesn't cause the page to freeze. It's because it's iterating through all emojis, doing the expensive tag calculation, and generating DOM elements for each. JS blocks the main thread, fetch does not.

Jump in the discussion.

No email address required.

But we can fix that by using blocking xhr :marseyfluffy:

Jump in the discussion.

No email address required.

I see what you're referring to now. We're both correct, though I never paid much attention to the blocking scripts and was only thinking about the network request. I suppose I underestimated its impact. On my machine the emoji json is ~450ms (50/50 for response/download) on the network side and blocking scripts is ~750ms. Still, both should be improved.

Jump in the discussion.

No email address required.

The emote picker is slow for me too but I just bite the pillow about it.

Jump in the discussion.

No email address required.

Your'e really trying to become my enemy now, huh?

Jump in the discussion.

No email address required.

My love has room for contempt :marseyhearts: :marseyp!athetic2:

Jump in the discussion.

No email address required.

I didn't even read your original comment but now I went back and did. You already are my enemy besides being my friend because you're one of my biggest downvoters.

Go back through and explain your reasoning for each downvote you've given.

Jump in the discussion.

No email address required.

More comments

Will it be fixed?

Jump in the discussion.

No email address required.

jesus christ

working on realtime shit makes me cringe hard at webshitter 'code' like this

but then again, it fricking works, and I'm sitting over here trying to prematurely optimize my code to run 0.25ms faster for hours :marseyschizowall:

Jump in the discussion.

No email address required.

looks like the pause is only on the 1st attempt, subsequent attempts load near-instantly

Jump in the discussion.

No email address required.

Ok but what if I said you are a :!marseytrain: b-word?

Jump in the discussion.

No email address required.

Instead of the dom nodes just use class with background image on the pseudo element in a minified style file that is async. You could frick with turning them into inline svgs but with so many files your css file might explode in size, but it is handy for common shit. Be sure to cache all these files too or you're really ducking yourself

That will be $1500 dollars pay whenever

Jump in the discussion.

No email address required.

Just remove all the shitty useless ones.

Jump in the discussion.

No email address required.

No. :#marcusrcaconnectingfast: :#marseyrcaconnectingfast:

Jump in the discussion.

No email address required.

I'll give you a big O


https://i.rdrama.net/images/17146493335425022.webp In the grizzly darkness of the far future, there is only moid seethe.

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/16973276168906765.webp

Jump in the discussion.

No email address required.

░░░░░░▄▄▄░░▄██▄
░░░░░▐▀█▀▌░░░░▀█▄
░░░░░▐█▄█▌░░░░░░▀█▄
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀
░░░░▄▄▄██▀▀▀▀
░░░█▀▄▄▄█░▀▀
░░░▌░▄▄▄▐▌▀▀▀
▄░▐░░░▄▄░█░▀▀U HAVE BEEN SPOOKED BY THE
▀█▌░░░▄░▀█▀░▀
░░░░░░░▄▄▐▌▄▄
░░░░░░░▀███▀█░▄
░░░░░░▐▌▀▄▀▄▀▐▄SPOOKY SKELETON
░░░░░░▐▀░░░░░░▐▌
░░░░░░█░░░░░░░░█
░░░░░▐▌░░░░░░░░░█
░░░░░█░░░░░░░░░░▐▌SEND THIS TO 7 PPL OR SKELETONS WILL EAT YOU
Jump in the discussion.

No email address required.

binary searching

Uhhh could you use more inclusive terms please?

Jump in the discussion.

No email address required.

https://media.giphy.com/media/3oEduI0OFVIaFIqolW/giphy.webp

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.