Better HN
topnewbestaskshowjobs
Log inSign up

crazyguitar

96 karma · joined Sep 18, 2016 (10y ago) · 35 submissions

Submissions

1.

Show HN: Nvshmem from Scratch – RDMA, GPUDirect, and GPU Networking Demystified(cppcheatsheet.com ↗)

1 points · by crazyguitar · 9mo ago · discuss

comment 10mo ago · link · parent

Thank you for sharing this excellent resource! You make a great point—searching for "modern C++" often surfaces C++11-era content, while newer standards have already deprecated some of those "modern" practices. That's exactly why I created this project: to continuously update and document contemporary best practices as the language evolves. I'll definitely check out the linked rant for ideas to incorporate. Thanks for the suggestion!

comment 10mo ago · link · parent

Thanks. This is a awesome suggestion. Will dive deep what is the better way to do.

4.

Show HN: C/C++ Cheatsheet – a modern, practical reference for C and C++(github.com ↗)

10 points · by crazyguitar · 10mo ago · 6 comments

5.

Show HN: Libefaxx – A Microbenchmark for AWS EFA GPU/CPU RDMA Communication(github.com ↗)

2 points · by crazyguitar · 11mo ago · discuss

comment 6y ago · link · parent

I understand you are worried about newbies misuse APIs. You remind me that I should add a warning to inform the sample code in this article should not use in programs. Thanks.

Also, I did not advocate a newbie should start and stop threads by themselves. I want to say I agree that we should use high-level APIs in most cases, but, in some cases, we may need to use low-level APIs to achieve our missions. I am unwilling to limit what kind of APIs should use. In my opinion, like you said: "you have just seriously over-architected the solution," we should be careful to use APIs. Even though high-level APIs are safer, programmers may misuse them.

comment 6y ago · link · parent

I think this is not an excellent solution. You have to wait for all threads finish. I agree that we should use high-level API in most of the time, but, in some cases, we still need low-level APIs to support us to reach some goals.

comment 6y ago · link · parent

I agree with you. We should use a reliable library, as you said. The primary purpose of this article is to help people understand what a coroutine and an event loop are. Therefore, programmers can use asyncio API fluently without misuse.

However, I don't think use threads/processes is a bad idea. A pool gives you a constrain to utilize threads/processes, but sometime we may want to adjust the number of threads/processes based on system load. Under this circumstance, using a pool is not the best choice.

comment 6y ago · link · parent

I think the syntax, `yield from`, and `@coroutine` are two things. `async def` + `yield from` means we delegate generator to another generator. Therefore, in the async function, using `yield from` is equal to declare an asynchronous generator function.

However, using `@coroutine` + `yield from` means we transform a generator into a generator coroutine. Because a generator is a form of coroutine, in Python 3.4, `@coroutine` turns a function or a future into a generator function. Note that if a function is a generator function, `@coroutine` does not do anything. Based on the document, Python recommends using `async def` instead of `@coroutine` to declare a coroutine because `@coroutine` will be removed in Python 3.10.

comment 6y ago · link · parent

Oh! sorry! thx

comment 6y ago · link · parent

Yeah! I know that @coroutine and yield from are deprecated. This article focuses on how coroutines cooperate with event loops in Python. You remind me that I should add a warning to inform your information. Thanks.

comment 6y ago · link · parent

Oh! I understand. You're right. Some descriptions mix coroutines and event loops together. thx

comment 6y ago · link · parent

Nice. Thanks

comment 6y ago · link · parent

Awesome! Thank you

comment 6y ago · link · parent

I understand. I will review my contents persistently. BTW, if you are available, could you give me some writing tips? Thank you so much.

comment 6y ago · link · parent

async/await is a better design pattern without considering low-level APIs such as epoll. It is not a new kind of threading/loop. Python provides a user-level scheduler for developers, so they don't need to implement their scheduler from scratch. In my opinion, the reason why using an event loop can acquire better performance is to decrease the number of times to lock some critical sections. Also, this pattern can increase the cache hit and mitigate CPU context switch frequency.

comment 6y ago · link · parent

I agree.

18.

A Hitchhiker’s Guide to Asynchronous Programming(github.com ↗)

181 points · by crazyguitar · 6y ago · 43 comments

19.

Debugging via GDB with Python(pythonsheets.com ↗)

2 points · by crazyguitar · 6y ago · discuss

20.

PEP 572 and the Walrus Operator(github.com ↗)

1 points · by crazyguitar · 6y ago · discuss

12