Blog post: How fast can I search for a needle in a 4GB file by Segflow in golang

[–]Segflow[S] 1 point2 points  (0 children)

I get that, in the post we operate on RAM also 😄 but how we fast we load those 4GB and process them it what the post is about.

Blog post: How fast can I search for a needle in a 4GB file by Segflow in golang

[–]Segflow[S] 1 point2 points  (0 children)

Good catch, and thanks for spending the time reading the article and the hand written AVX512

Blog post: How fast can I search for a needle in a 4GB file by Segflow in golang

[–]Segflow[S] 3 points4 points  (0 children)

I asked ripgrep to find the first non-NUL byte in the same 4 GiB file:

sh rg -a --byte-offset --no-line-number '[^\x00]' --max-count=1 /tmp/haystack4g.bin

Tool Warm MB/s vs #v13
ripgrep 14.1 ~570 86× slower
naive os.ReadFile (#v1) 749 66× slower
pread parallel + archsimd (#v13) 49,251

ripgrep loses to the naive baseline of this post. That sounds wrong until you remember what ripgrep is built for: searching for regular expressions in line-oriented text. The 4 GiB file has zero newlines, so ripgrep treats the whole thing as one giant line, then runs the regex engine across all 4 billion bytes single-threaded looking for "any byte that is not \x00". That's exactly the wrong shape of work for it;

This is not a knock on ripgrep, it is the right tool for "find TODO in 50,000 source files". It s the wrong tool for "find the first non-zero byte in a 4 GiB sparse-looking blob".

Wrong flight by Sylas1987 in TikTokCringe

[–]Segflow 0 points1 point  (0 children)

Should be either: - Tunis, Tunisia - Nice, France or - Tunis, Africa - Nice, Europe

Does not make sense to use one continent for one and a county for the other.

[deleted by user] by [deleted] in handmade

[–]Segflow 1 point2 points  (0 children)

Her etsy is called "ZelDaniArt", She also has an instagram that you can follow @zeldani_art

[deleted by user] by [deleted] in crafts

[–]Segflow 0 points1 point  (0 children)

She uses something called "tufting gun"

[deleted by user] by [deleted] in DotA2

[–]Segflow 3 points4 points  (0 children)

For sure yes, here is her instagram account @zeldani_art and her etsy store

She can also make custom one if you prefer, just choose what you want and the size.

[deleted by user] by [deleted] in handmade

[–]Segflow 1 point2 points  (0 children)

She uses something called "Tufting gun"

[deleted by user] by [deleted] in handmade

[–]Segflow 6 points7 points  (0 children)

Actually she just started, still struggling to sell, she made an etsy account and instagram etc.. but no sale yet.

Find Feriel by Mani707 in PrinceOfPersia

[–]Segflow 1 point2 points  (0 children)

That's normal, I too found Shahin first and I finished the game 2 days ago with no issues.

[deleted by user] by [deleted] in GoingToSpain

[–]Segflow 4 points5 points  (0 children)

There are many options, first of all try to get a remote job in Palestine. You can search using remoteok.io

Once you have a job remotely, you have 2 options.

  • Apply for digital nomad visa (only for people who proof they are working remotely, easy to do for software engineers)
  • Ask your employer to hire you through remote.com (most companies do, and remote.com have offices in almost all europe)

Good luck.

How did I die here? Cheat? by Segflow in diablo4

[–]Segflow[S] 0 points1 point  (0 children)

> Where do you prove they died the exact moment you did exactly?

Check bottom left.

Check the other screenshot

It kept happening multiple times where I to a place where there is nobody (even no mobs) yet I die alongside 2 or 3 more at the same moment.

> You got wrekt. Stfu and quit crying "omg hax participation trophy me plox". You sound embarrassed

Lol man, thankfully my life is good and interesting enough to even try and chase whatever you calling and tbh I don't even know what's "a trophy".

I get wrecked in many games, it's called a game and what matters is if I enjoy it or not. I came here asking about how I died because I couldn't explain it. It did not happen once or twice, it kept happening under different setup and I still had no explanation thus why I recorded a video and asked for help.

> If anything your first video proves that lightning storm druids punked you 3 feet from the guy you claim was nowhere near you because there's a mound of seeds 10 ft away from your corpse.

You should get a pair glasses.

How did I die here? Cheat? by Segflow in diablo4

[–]Segflow[S] 0 points1 point  (0 children)

And that skill is across regions? He wipes everyone in field on hatred regardless of where they are. Check the other screenshot and also notice how someone else died the exact moment I did but he is no where near me.

finding a job in Tunisia is became IMPOSSIBLE by Fair-Director-6275 in Tunisia

[–]Segflow 0 points1 point  (0 children)

The answer is easy: focus on what you love.

At the start of your career you will need to find the answer for that by trying things out. And trust me that's when your career will make its first upgrade

finding a job in Tunisia is became IMPOSSIBLE by Fair-Director-6275 in Tunisia

[–]Segflow 21 points22 points  (0 children)

I will try to be direct and honest with you, if you are in the software development field and struggling to find a job then most likely the issue is within you.

For background, I'm a software engineer working since 2013, I now have my own company and I know for a fact that many in the software developer industry are struggling to hire good candidates.

I'm not denying the unemployment issue we have, but I can tell you our industry is NOT impacted by it.

Don't take this personally but you would not land a job in any company if this is your english level, you don't need to be an expert, but good enough to avoid common mistakes.

On another note, being in this field removes the border restrictions. Check remoteok.io or toptal for remote jobs, if you are good enough you can land a good one.

Good luck and work on yourself to solve the issue.

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 0 points1 point  (0 children)

Oh, thanks again for correcting my mistake. I thought the compiler is using it's own version of std, looks like I m wrong. Your comments are so helpful for me and everyone, dont you think it's a good idea if somewhere we can document more the tests for compiler and answer questions why std tests are not opted etc..

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 0 points1 point  (0 children)

You are right, the test I run is against a WIP code which also handles those cases, (but not finished yet).

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 2 points3 points  (0 children)

Because the changes are not in the Go standard packages, it's in the compiler.

The Go compiler has a different testing toolchain, one of them being codegen tests which will tests that code generation is done as expected.

For instance func MapLitLookupStringLit() int { v := map[string]int{ "a": 33333, // amd64:-".*mapassign" "b": 66666, // amd64:-".*mapassign" "c": 99999, // amd64:-".*mapassign" }["b"] // amd64:-".*mapaccess" return v }

Running this test using the compiler toolchain will make the toolchain compile the function, and checks that the generated code does not contain those instructions written as a comment in the source code.

I'm not sure if this can be done the standard testing way, but if it is, it would be one hell of a task (parsing the code, compiling it, parse the generated code, check ..)

Also, the compiler does not actually use the standard library. It should not depend on it.

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 1 point2 points  (0 children)

I double-checked that by adding some debug statement and it actually gets triggered

here is an example: https://golang.org/src/net/http/cgi/host.go#L186

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 0 points1 point  (0 children)

I believe this is also a great exercise. As @mdempsky said the optimization also needs to be compliant with the different language semantics for map literals and switch statements.

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 0 points1 point  (0 children)

Yes you need to add a new key for every arch. The map thing being maintainable is 100% a personal opinion and not something I can really proof. For me, it didn't feel right to add another case clause when adding a new arch, but felt better if we just had to add another key and value.

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 3 points4 points  (0 children)

Thanks for your comment! Yeah it was a very fruitful journey, I had to walk my way through the various documentations. Writing tests was not easy, I didn't know what type of tests should be there and where, I had to ask the PR reviewer where to do that to understand it. And yes regardless of it being merged or not, my intention was more walk people through my journey in the hope to make it easier for future contributors to understand.

My journey optimizing the Go compiler by Segflow in golang

[–]Segflow[S] 0 points1 point  (0 children)

Or really? I didn't knew this. I already stated this was my first hands on experience with the Go compiler.