Eddie

837 posts

Eddie banner
Eddie

Eddie

@onfe1

Maker, designer, developer • he/him • Engineer @Arm

United Kingdom เข้าร่วม Mart 2013
160 กำลังติดตาม2.2K ผู้ติดตาม
ทวีตที่ปักหมุด
Eddie
Eddie@onfe1·
I've left twitter, find me on onfe.uk
English
0
0
0
113
Eddie รีทวีตแล้ว
Simon
Simon@_smcf·
Simon tweet media
ZXX
14
372
4.2K
231.6K
Eddie รีทวีตแล้ว
Daniel Lemire
Daniel Lemire@lemire·
The fast JavaScript runtime Bun is much faster than Node.js 22 at decoding Base64 inputs. By much faster, I mean *several times* faster. But they both rely on the same underlying library (simdutf) for the actual decoding. So what gives? The problem is that Node.js needs to interact with v8, the underlying JavaScript engine (from Google)... and doing so is not trivial. Before we can start decoding the string, we need to grab the string... so, in this instance, we call String::Value... In turns, this allocates an array inside Node.js and asks v8 to copy the content to it... In an ideal world, we would avoid the trouble entirely and just ask v8 to give us direct access to how it stores the string... and we try to do that if we can... but let me come back to it... How bad can this be, right? Just a copy. Well. Let us do some profiling... So you see, the base64 decoding itself is about about 1/5 of the running time, but the copy takes half of it. What is up with this CopyChars function? Well, it is mostly just a wrapper around the standard high level C++ function std::copy_n as far as I can tell. (see v8/src/utils/memcopy.h) But we are copying for an 8-bit input to a 16-bit output... why is that? Base64 is pure ASCII... and v8 can store ASCII using 8-bit per character. We get there before both IsExternalOneByte() and IsOneByte() are false (see node/src/node_buffer.cc)... We have fast paths for these cases. If IsExternalOneByte() is true, we just get the bytes and everything is great. Unfortunately, it does not always work. So we have a v8 string that is really pure ASCII, but, seemingly, we can't tell that it is the case from Node.js, and so we have to convert it to UTF-16 needlessly, using a function that is maybe not very well optimized... and then we do the base64 decoding of an ASCII string from the UTF-16 input. It is not great. To be fair, this is just one string, created as 'Buffer.alloc(size, "latin1").toString("base64")', basically the base64 encoded version of the string "latin1latin1latin1...". In actual applications, we might have better luck. Yet. Yet. I am telling this complicated story for a reason. The story illustrates why our software is slower than it should be. We have layers of abstractions to fight against. Sometimes you win, sometimes you lose. These layers are there for a reason, but they are not free. To make matters worse... these abstraction layers often thicken over time... and the friction goes up. To be clear, I do not claim that the Node.js code is optimal. In fact, I know it can be better. But it is not trivial to make it go fast. I sometimes hear people say... "well, it is C++ and C++ is hard". No. The C++ part is easy relatively speaking. The difficulty is at a higher level. It is not a matter of syntax. It is a matter of architecture.
Daniel Lemire tweet mediaDaniel Lemire tweet mediaDaniel Lemire tweet media
Jarred Sumner@jarredsumner

In the next version of Bun `Buffer.from(str, "base64")` gets 6x - 30x faster on large input, thanks to @lemire's simdutf

English
33
234
1.6K
556.6K
Eddie รีทวีตแล้ว
Tantacrul (@tantacrul.bsky.social)
1. I'm legit shocked by the design of @Meta's new notification informing us they want to use the content we post to train their AI models. It's intentionally designed to be highly awkward in order to minimise the number of users who will object to it. Let me break it down.
Tantacrul (@tantacrul.bsky.social) tweet media
English
363
3.1K
11.9K
2.8M
Eddie
Eddie@onfe1·
the boy... he is here
English
0
0
1
251
Eddie
Eddie@onfe1·
I added this feature!! 🤗 popopop in plushie mode 👏👏
English
0
0
0
220
Eddie รีทวีตแล้ว
Emil Privér
Emil Privér@emil_priver·
Emil Privér tweet media
ZXX
17
490
6K
238.6K
Eddie
Eddie@onfe1·
y'all best be glad my mspaint skills never made the cut for @popcatclick
Eddie tweet media
English
0
0
0
147
Eddie
Eddie@onfe1·
@geromegamzing @youtooz I think it looks quite good IRL, but thanks for the feedback - what would you change?
English
1
0
0
14
Eddie
Eddie@onfe1·
We've been working with @youtooz to bring out this popcat.click plushie It'll be available very soon, for a limited time⏳
English
1
0
0
235
Eddie รีทวีตแล้ว
Linuxopsys
Linuxopsys@linuxopsys·
Back Door
Linuxopsys tweet media
English
8
461
4K
114.6K
Eddie รีทวีตแล้ว
caesararum, BS, DOGS
caesararum, BS, DOGS@caesararum·
"The customer has nuclear weapons" #c4" target="_blank" rel="nofollow noopener">gcc.gnu.org/bugzilla/show_…
caesararum, BS, DOGS tweet media
English
39
448
4.8K
646.3K
Eddie รีทวีตแล้ว
trash jones
trash jones@jzux·
surely this is the three day weekend that will replenish my will to live
English
6
440
5K
241.9K
Eddie รีทวีตแล้ว
cje
cje@caseyjohnellis·
he’s making a list,
he’s checking it twice,
he’s gonna find out who's naughty or nice,
santa claus is in contravention of article 4 of the General Data Protection Regulation (EU) 2016/679.
English
13
631
3.4K
215.1K
Eddie รีทวีตแล้ว
IroncladDev
IroncladDev@IroncladDev·
IroncladDev tweet media
ZXX
73
288
2.9K
143.2K
Eddie รีทวีตแล้ว
terminally onλine εngineer
you know those services I refactored without filling a jira ticket?
terminally onλine εngineer tweet media
English
81
555
5.5K
951.1K
Eddie รีทวีตแล้ว
popcat.click
popcat.click@PopCatClick·
✨🆕 SHOP.POPCAT.CLICK 🆕✨ 🛍️🙀 POP! POP! POP! POP! 🙀🛍️
popcat.click tweet media
Polski
30
14
31
17.8K
Eddie รีทวีตแล้ว
Thing Bad
Thing Bad@Merman_Melville·
kind of a bummer to have been born at the very end of the Fuck Around century just to live the rest of my life in the Find Out century
English
264
42.2K
250.4K
0