42 Matching Annotations
  1. Aug 2022
  2. Jul 2022
  3. May 2022
  4. Apr 2022
    1. 如果直接使用 DllCall 会报错,那么使用 DllLoad 先将 dll 文件加载有时就可以解决问题

      猜测难道是 golang 编译的 dll 文件太大(2-3Mb)导致DllCall 会直接导致 ahk 程序退出?

  5. Mar 2022
  6. Nov 2021
  7. Oct 2021
    1. It’s important to understand that even though a slice contains a pointer, it is itself a value. Under the covers, it is a struct value holding a pointer and a length. It is not a pointer to a struct.

      slice 是一个包含指针的结构体,他是一个具体值而不是指针

    1. 那为什么在上面的场景中,atomic会比mutex性能好很多呢?作者 Dmitry Vyukov 总结了这两者的一个区别: Mutexes do no scale. Atomic loads do. Mutex由操作系统实现,而atomic包中的原子操作则由底层硬件直接提供支持。在 CPU 实现的指令集里,有一些指令被封装进了atomic包,这些指令在执行的过程中是不允许中断(interrupt)的,因此原子操作可以在lock-free的情况下保证并发安全,并且它的性能也能做到随 CPU 个数的增多而线性扩展。

      多核场景中, atomic 性能优于 mutex 的原因

  8. Sep 2021
  9. Apr 2021
    1. Style definitions for nice terminal layouts. Built with TUIs in mind.

  10. Jan 2021
  11. Dec 2020
  12. Oct 2020
  13. Jun 2020
  14. May 2020
    1. we should never blindly apply dogmatic advice, and that we should use our judgment each and every time.

      menjadi manusia berkesedaran, memiliki pemikiran sendiri, jangan menelan mentah-mentah apa yang dibaca

  15. Apr 2020
    1. If the word “share” doesn’t come out of your mouth, you don’t need to use a pointer

      key point

    2. The benefit of passing data “by value” is readability. The value you see in the function call is what is copied and received on the other side

      no hidden cost, eg., memory growth on the heap or pauses during garbage collection. but there is a cost in stack memory usage and "scoping" among multiple stack frames, CPU caching, etc.

    3. Functions execute within the scope of frame boundaries that provide an individual memory space for each respective function. Each frame allows a function to operate within their own context and also provides flow control. A function has direct access to the memory inside its frame, through the frame pointer, but access to memory outside its frame requires indirect access. For a function to access memory outside of its frame, that memory must be shared with the function.

      eg., shared via the "pointer" to an address in heap memory

  16. Oct 2019
    1. The log will become something of a commoditized interface, with many algorithms and implementations competing to provide the best guarantees and optimal performance.

      Are golang channels an implementation of log?

  17. Aug 2019
  18. May 2019
    1. Go Programming Language publicly in 2009 they were also looking to solve certain challenges of the existing Computer languages. Of the many features that it demonstrated (we will get to those soon enough) it was also helpful in addressing the strange dilemma of hardware and software that was emerging.

      Golang is a modern computing language, designed especially for modern computing needs.

  19. Mar 2019
  20. Jan 2018
  21. Sep 2017
  22. Jul 2017
    1. (It's usually a mistake to pass back the concrete type of an error rather than error, for reasons discussed in the Go FAQ, but it's the right thing to do here because ServeHTTP is the only place that sees the value and uses its contents.)

      Good clarifying comment on when to pass back the concrete type of an error.

  23. Jan 2017
  24. Jul 2016
    1. There are two reasons for having no warnings. First, if it's worth complaining about, it's worth fixing in the code.
  25. Aug 2015