16 Matching Annotations
  1. Oct 2022
    1. 在新版本(起码 1.15 及以后)的 Go 当中,sync.Pool 里的临时对象需要两次 GC 才会被真正清除掉。 // 只一次 GC 的话只会让其中的临时对象被“打上记号”。 // 更具体的说,只做一次 GC 只会使得 sync.Pool 里的临时对象被移动到池中的“备用区域”(详见 victim 字段)。 // 在我们调用 sync.Pool 的 Get 方法时,如果 sync.Pool 的“本地区域”(详见 local 字段)当中没有可用的临时对象, // 那么 sync.Pool 会试图从这个“备用区域”中获取临时对象。 // 如果“备用区域”也没有可用的临时对象,sync.Pool 才会去调用 New 函数。 // 所以,这里的例子需要再添加一行对 runtime.GC() 函数的调用,才能使它的结果与最初的相同,并起到准确示范的作用。

      runtime.GC()

  2. Feb 2022
  3. Apr 2021
  4. Mar 2021
    1. If JavaScript were detached from the client and server platforms, the pressure of being a monoculture would be lifted — the next iteration of the JavaScript language or run-time would no longer have to please every developer in the world, but instead could focus on pleasing a much smaller audience of developers who love JavaScript and thrive with it, while enabling others to move to alternative languages or run-times.
    2. As to opinions about the shortcomings of the language itself, or the standard run-times, it’s important to realize that every developer has a different background, different experience, different needs, temperament, values, and a slew of other cultural motivations and concerns — individual opinions will always be largely personal and, to some degree, non-technical in nature.
    1. As a simple example of a basic runtime system, the runtime system of the C language is a particular set of instructions inserted into the executable image by the compiler. Among other things, these instructions manage the process stack, create space for local variables, and copy function-call parameters onto the top of the stack. There are often no clear criteria for deciding which language behavior is considered inside the runtime system versus which behavior is part of the source program. For C, the setup of the stack is part of the runtime system, as opposed to part of the semantics of an individual program, because it maintains a global invariant that holds over all executions. This systematic behavior implements the execution model of the language
    1. The ECMAScript standard does not include any input/output (I/O), such as networking, storage, or graphics facilities. In practice, the web browser or other runtime system provides JavaScript APIs for I/O.
  5. Nov 2020
    1. But what if you want a runtime with some features? what if you want, say, a runtime with very powerful coroutine support? The answer is: you write Go.
    2. Notably, LLVM and JVM are by far the most prominent targets in this scenario: they’re both open-source and well-documented targets that provide a ton of firepower, and there frankly aren’t a ton of other options.
    3. The environment in which an executing program operates is sometimes called its “runtime environment,” or just runtime
    4. When you write a C program, your runtime environment is very bare – the C compiler turns your code into machine code and really adds very little beyond that. When you write a Python program, however, the runtime is rich: the interpreter is the thing that’s actually running, and does things like managing your memory and doing function dispatch for you.
  6. Oct 2020
    1. Wait what? No runtime. How does that work? Well, obviously JavaScript executes at runtime, so was he saying he doesn't reuse any code? Well as it turns out the message here has changed. I looked and sure enough there was a runtime. Of course there was.