Kostiantyn Koval

Swift High Performance

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • Enzohas quoted5 years ago
    Swift is also a static programming language. Its source code is compiled to the assembly code and the assembly code is compiled to the machine code using the LLVM tool. Running native machine code instructions is the fastest way of doing this. In comparison, Java and C# are compiled to a piece of intermediate code, and it needs a virtual machine to run it, or another tool that will translate it into machine instructions. Because Swift doesn't do this at runtime, it has a very big performance gain
  • Enzohas quoted5 years ago
    A lazy collection or sequence performs an operation, for example, a mapping of elements, when we start pulling elements from it. The difference here is that a regular array applies a mapping only once for every element and returns the result immediately.
  • Enzohas quoted5 years ago
    Global variables and constants are always loaded lazily in Swift. This means that every global variable is initialized only when you access it for the first time.
  • Enzohas quoted5 years ago
    You should apply a code separation technique very often to different components as an example.
  • Enzohas quoted5 years ago
    The @noescape attribute indicates that a closure will be used inside a function body, before the function return is called. It means it won't escape the function body.
    When you apply this attribute, it indicates that a closure will be used synchronously inside the function body. Also, it means that it will be released when you leave the function. The lifetime of that closure parameter can't outlive the function call.
  • Enzohas quoted5 years ago
    When you make a parameter with the @autoclosure attribute, the expression you pass as an argument is automatically wrapped into a closure for you. It makes your code cleaner. That's all it does. No magic; it simply removes boilerplate code for you.
  • Enzohas quoted5 years ago
    Swift 2.0 moves to methods over free functions, so it prefers to use an immutable method.
  • Enzohas quoted5 years ago
    The NSOperationQueue provides a more high-level API but it is also a bit slower than GCD. NSOperationQueue fits very well with controlling the application flow, when tasks need to be chained, depend on each other, or need to be canceled.
  • Enzohas quoted5 years ago
    When you use a concurrent queue and dispatch a task to it synchronously, the queue can run many tasks at the same time, but the dispatch_sync method waits until the task you submitted is finished.
  • Enzohas quoted5 years ago
    Synchronous dispatch submits a task for execution and waits until the task is done.
fb2epub
Drag & drop your files (not more than 5 at once)