Live data from Hacker News

Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

lemire.me

11–20 of 51 posts

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#11
SVE and SVE2 are similar to Intel's AVX512-etc for vector, I would use intrinsics instead of hand crafting ASM code, unless it's a performance bottleneck.

And yes if you want to play with SVE, Amazon's own ARM chip is the best one available now, maybe the only one in fact, for the general public.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#12
post #10

Thanks for sharing. Is understanding how best to utilize computer hardware part of a classic CS program or is most learned on the job? I studied Econ in college and been a python guy for last 8 years but have no knowledge of how the machine actually interacts with my code. Is there a formal name for understanding that?

CS program, but depends on the classes you take. For me, the main class was called "computer architecture". Classes about compilers, databases, servers, embedded programming, server clustering can all help to understand the machine.

Of course, it can be learned on your own too. But generally this path is harder because it's hard to know what to study. The CS program will expose you to breadth of concepts.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#13
post #10

Thanks for sharing. Is understanding how best to utilize computer hardware part of a classic CS program or is most learned on the job? I studied Econ in college and been a python guy for last 8 years but have no knowledge of how the machine actually interacts with my code. Is there a formal name for understanding that?

You should work through Nand2Tetris :) it will give you an understanding of how computers work at a very, very low level.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#14
post #9
post #6

> char * init_out{out}; Are the curly braces in the initialization some new C++ syntax? I haven't been keeping up with C++ developments in the last decade or so. Based on the code that follows I would expect char* init_out = out;

That's been around since C++11 although it's kind of weird to see it used for a char*

A bit weird, but I would support a local style guide that limits initialization style choices to parens for calling non-initializer-list constructors and braces for everything else — for simplicity, consistency, less confusion with assignment, and that odd case where it would actually catch an error (unindended narrowing conversion).

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#15
post #5

The complexity almost looks like an April Fools joke.

But if it's hidden behind a standard library's 'trim' functions it's all fine to me; I don't need to know how it works under the hood, but want to rely on the maintainer's knowledge that their implementation is as fast and efficient as possible on whichever architecture.

Low level string operations happen so often under the hood in any application that 10x more code and complexity in an implementation is worth it if it increases efficiency.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#17
post #5

The complexity almost looks like an April Fools joke.

But if it's hidden behind a standard library's 'trim' functions it's all fine to me; I don't need to know how it works under the hood, but want to rely on the maintainer's knowledge that their implementation is as fast and efficient as possible on whichever architecture. Low level string operations happen so often under the hood in any application that 10x more code and complexity in an implementation is worth it if…

It's also 3.6 times faster, in a world where hardware updates get you 20-ish % improvements per generation.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#18
post #10

Thanks for sharing. Is understanding how best to utilize computer hardware part of a classic CS program or is most learned on the job? I studied Econ in college and been a python guy for last 8 years but have no knowledge of how the machine actually interacts with my code. Is there a formal name for understanding that?

It'd be fun to ask Daniel Lemire's undergrads if they learned about vector/simd instructions.

It's hard for me to answer, because I was learning everything I could on the internet before undergrad, following each tiny micro-architectural tweak in minute detail. It makes it hard to remember what things college really provided & what was self-taught.

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#19
post #10

Thanks for sharing. Is understanding how best to utilize computer hardware part of a classic CS program or is most learned on the job? I studied Econ in college and been a python guy for last 8 years but have no knowledge of how the machine actually interacts with my code. Is there a formal name for understanding that?

at my school (ordinary well-known state university), barely any CS students would graduate knowing how to approach this

Re: Trimming spaces from strings faster with SVE on an Amazon Graviton 3 processor

#20
post #5

The complexity almost looks like an April Fools joke.

No matter how advanced we think we are we are still worrying about minutiae like trimming spaces from strings.

humans putting text into form fields will never go away probably, so you will always have to do this at some point.
Post reply on HN